Show More
@@ -1,978 +1,980 | |||||
1 | """IPython terminal interface using prompt_toolkit""" |
|
1 | """IPython terminal interface using prompt_toolkit""" | |
2 |
|
2 | |||
3 | import asyncio |
|
3 | import asyncio | |
4 | import os |
|
4 | import os | |
5 | import sys |
|
5 | import sys | |
6 | from warnings import warn |
|
6 | from warnings import warn | |
7 | from typing import Union as UnionType |
|
7 | from typing import Union as UnionType | |
8 |
|
8 | |||
9 | from IPython.core.async_helpers import get_asyncio_loop |
|
9 | from IPython.core.async_helpers import get_asyncio_loop | |
10 | from IPython.core.interactiveshell import InteractiveShell, InteractiveShellABC |
|
10 | from IPython.core.interactiveshell import InteractiveShell, InteractiveShellABC | |
11 | from IPython.utils.py3compat import input |
|
11 | from IPython.utils.py3compat import input | |
12 | from IPython.utils.terminal import toggle_set_term_title, set_term_title, restore_term_title |
|
12 | from IPython.utils.terminal import toggle_set_term_title, set_term_title, restore_term_title | |
13 | from IPython.utils.process import abbrev_cwd |
|
13 | from IPython.utils.process import abbrev_cwd | |
14 | from traitlets import ( |
|
14 | from traitlets import ( | |
15 | Bool, |
|
15 | Bool, | |
16 | Unicode, |
|
16 | Unicode, | |
17 | Dict, |
|
17 | Dict, | |
18 | Integer, |
|
18 | Integer, | |
19 | List, |
|
19 | List, | |
20 | observe, |
|
20 | observe, | |
21 | Instance, |
|
21 | Instance, | |
22 | Type, |
|
22 | Type, | |
23 | default, |
|
23 | default, | |
24 | Enum, |
|
24 | Enum, | |
25 | Union, |
|
25 | Union, | |
26 | Any, |
|
26 | Any, | |
27 | validate, |
|
27 | validate, | |
28 | Float, |
|
28 | Float, | |
29 | ) |
|
29 | ) | |
30 |
|
30 | |||
31 | from prompt_toolkit.auto_suggest import AutoSuggestFromHistory |
|
31 | from prompt_toolkit.auto_suggest import AutoSuggestFromHistory | |
32 | from prompt_toolkit.enums import DEFAULT_BUFFER, EditingMode |
|
32 | from prompt_toolkit.enums import DEFAULT_BUFFER, EditingMode | |
33 | from prompt_toolkit.filters import HasFocus, Condition, IsDone |
|
33 | from prompt_toolkit.filters import HasFocus, Condition, IsDone | |
34 | from prompt_toolkit.formatted_text import PygmentsTokens |
|
34 | from prompt_toolkit.formatted_text import PygmentsTokens | |
35 | from prompt_toolkit.history import History |
|
35 | from prompt_toolkit.history import History | |
36 | from prompt_toolkit.layout.processors import ConditionalProcessor, HighlightMatchingBracketProcessor |
|
36 | from prompt_toolkit.layout.processors import ConditionalProcessor, HighlightMatchingBracketProcessor | |
37 | from prompt_toolkit.output import ColorDepth |
|
37 | from prompt_toolkit.output import ColorDepth | |
38 | from prompt_toolkit.patch_stdout import patch_stdout |
|
38 | from prompt_toolkit.patch_stdout import patch_stdout | |
39 | from prompt_toolkit.shortcuts import PromptSession, CompleteStyle, print_formatted_text |
|
39 | from prompt_toolkit.shortcuts import PromptSession, CompleteStyle, print_formatted_text | |
40 | from prompt_toolkit.styles import DynamicStyle, merge_styles |
|
40 | from prompt_toolkit.styles import DynamicStyle, merge_styles | |
41 | from prompt_toolkit.styles.pygments import style_from_pygments_cls, style_from_pygments_dict |
|
41 | from prompt_toolkit.styles.pygments import style_from_pygments_cls, style_from_pygments_dict | |
42 | from prompt_toolkit import __version__ as ptk_version |
|
42 | from prompt_toolkit import __version__ as ptk_version | |
43 |
|
43 | |||
44 | from pygments.styles import get_style_by_name |
|
44 | from pygments.styles import get_style_by_name | |
45 | from pygments.style import Style |
|
45 | from pygments.style import Style | |
46 | from pygments.token import Token |
|
46 | from pygments.token import Token | |
47 |
|
47 | |||
48 | from .debugger import TerminalPdb, Pdb |
|
48 | from .debugger import TerminalPdb, Pdb | |
49 | from .magics import TerminalMagics |
|
49 | from .magics import TerminalMagics | |
50 | from .pt_inputhooks import get_inputhook_name_and_func |
|
50 | from .pt_inputhooks import get_inputhook_name_and_func | |
51 | from .prompts import Prompts, ClassicPrompts, RichPromptDisplayHook |
|
51 | from .prompts import Prompts, ClassicPrompts, RichPromptDisplayHook | |
52 | from .ptutils import IPythonPTCompleter, IPythonPTLexer |
|
52 | from .ptutils import IPythonPTCompleter, IPythonPTLexer | |
53 | from .shortcuts import ( |
|
53 | from .shortcuts import ( | |
54 | create_ipython_shortcuts, |
|
54 | create_ipython_shortcuts, | |
55 | create_identifier, |
|
55 | create_identifier, | |
56 | RuntimeBinding, |
|
56 | RuntimeBinding, | |
57 | add_binding, |
|
57 | add_binding, | |
58 | ) |
|
58 | ) | |
59 | from .shortcuts.filters import KEYBINDING_FILTERS, filter_from_string |
|
59 | from .shortcuts.filters import KEYBINDING_FILTERS, filter_from_string | |
60 | from .shortcuts.auto_suggest import ( |
|
60 | from .shortcuts.auto_suggest import ( | |
61 | NavigableAutoSuggestFromHistory, |
|
61 | NavigableAutoSuggestFromHistory, | |
62 | AppendAutoSuggestionInAnyLine, |
|
62 | AppendAutoSuggestionInAnyLine, | |
63 | ) |
|
63 | ) | |
64 |
|
64 | |||
65 | PTK3 = ptk_version.startswith('3.') |
|
65 | PTK3 = ptk_version.startswith('3.') | |
66 |
|
66 | |||
67 |
|
67 | |||
68 | class _NoStyle(Style): pass |
|
68 | class _NoStyle(Style): pass | |
69 |
|
69 | |||
70 |
|
70 | |||
71 |
|
71 | |||
72 | _style_overrides_light_bg = { |
|
72 | _style_overrides_light_bg = { | |
73 | Token.Prompt: '#ansibrightblue', |
|
73 | Token.Prompt: '#ansibrightblue', | |
74 | Token.PromptNum: '#ansiblue bold', |
|
74 | Token.PromptNum: '#ansiblue bold', | |
75 | Token.OutPrompt: '#ansibrightred', |
|
75 | Token.OutPrompt: '#ansibrightred', | |
76 | Token.OutPromptNum: '#ansired bold', |
|
76 | Token.OutPromptNum: '#ansired bold', | |
77 | } |
|
77 | } | |
78 |
|
78 | |||
79 | _style_overrides_linux = { |
|
79 | _style_overrides_linux = { | |
80 | Token.Prompt: '#ansibrightgreen', |
|
80 | Token.Prompt: '#ansibrightgreen', | |
81 | Token.PromptNum: '#ansigreen bold', |
|
81 | Token.PromptNum: '#ansigreen bold', | |
82 | Token.OutPrompt: '#ansibrightred', |
|
82 | Token.OutPrompt: '#ansibrightred', | |
83 | Token.OutPromptNum: '#ansired bold', |
|
83 | Token.OutPromptNum: '#ansired bold', | |
84 | } |
|
84 | } | |
85 |
|
85 | |||
86 | def get_default_editor(): |
|
86 | def get_default_editor(): | |
87 | try: |
|
87 | try: | |
88 | return os.environ['EDITOR'] |
|
88 | return os.environ['EDITOR'] | |
89 | except KeyError: |
|
89 | except KeyError: | |
90 | pass |
|
90 | pass | |
91 | except UnicodeError: |
|
91 | except UnicodeError: | |
92 | warn("$EDITOR environment variable is not pure ASCII. Using platform " |
|
92 | warn("$EDITOR environment variable is not pure ASCII. Using platform " | |
93 | "default editor.") |
|
93 | "default editor.") | |
94 |
|
94 | |||
95 | if os.name == 'posix': |
|
95 | if os.name == 'posix': | |
96 | return 'vi' # the only one guaranteed to be there! |
|
96 | return 'vi' # the only one guaranteed to be there! | |
97 | else: |
|
97 | else: | |
98 | return 'notepad' # same in Windows! |
|
98 | return 'notepad' # same in Windows! | |
99 |
|
99 | |||
100 | # conservatively check for tty |
|
100 | # conservatively check for tty | |
101 | # overridden streams can result in things like: |
|
101 | # overridden streams can result in things like: | |
102 | # - sys.stdin = None |
|
102 | # - sys.stdin = None | |
103 | # - no isatty method |
|
103 | # - no isatty method | |
104 | for _name in ('stdin', 'stdout', 'stderr'): |
|
104 | for _name in ('stdin', 'stdout', 'stderr'): | |
105 | _stream = getattr(sys, _name) |
|
105 | _stream = getattr(sys, _name) | |
106 | try: |
|
106 | try: | |
107 | if not _stream or not hasattr(_stream, "isatty") or not _stream.isatty(): |
|
107 | if not _stream or not hasattr(_stream, "isatty") or not _stream.isatty(): | |
108 | _is_tty = False |
|
108 | _is_tty = False | |
109 | break |
|
109 | break | |
110 | except ValueError: |
|
110 | except ValueError: | |
111 | # stream is closed |
|
111 | # stream is closed | |
112 | _is_tty = False |
|
112 | _is_tty = False | |
113 | break |
|
113 | break | |
114 | else: |
|
114 | else: | |
115 | _is_tty = True |
|
115 | _is_tty = True | |
116 |
|
116 | |||
117 |
|
117 | |||
118 | _use_simple_prompt = ('IPY_TEST_SIMPLE_PROMPT' in os.environ) or (not _is_tty) |
|
118 | _use_simple_prompt = ('IPY_TEST_SIMPLE_PROMPT' in os.environ) or (not _is_tty) | |
119 |
|
119 | |||
120 | def black_reformat_handler(text_before_cursor): |
|
120 | def black_reformat_handler(text_before_cursor): | |
121 | """ |
|
121 | """ | |
122 | We do not need to protect against error, |
|
122 | We do not need to protect against error, | |
123 | this is taken care at a higher level where any reformat error is ignored. |
|
123 | this is taken care at a higher level where any reformat error is ignored. | |
124 | Indeed we may call reformatting on incomplete code. |
|
124 | Indeed we may call reformatting on incomplete code. | |
125 | """ |
|
125 | """ | |
126 | import black |
|
126 | import black | |
127 |
|
127 | |||
128 | formatted_text = black.format_str(text_before_cursor, mode=black.FileMode()) |
|
128 | formatted_text = black.format_str(text_before_cursor, mode=black.FileMode()) | |
129 | if not text_before_cursor.endswith("\n") and formatted_text.endswith("\n"): |
|
129 | if not text_before_cursor.endswith("\n") and formatted_text.endswith("\n"): | |
130 | formatted_text = formatted_text[:-1] |
|
130 | formatted_text = formatted_text[:-1] | |
131 | return formatted_text |
|
131 | return formatted_text | |
132 |
|
132 | |||
133 |
|
133 | |||
134 | def yapf_reformat_handler(text_before_cursor): |
|
134 | def yapf_reformat_handler(text_before_cursor): | |
135 | from yapf.yapflib import file_resources |
|
135 | from yapf.yapflib import file_resources | |
136 | from yapf.yapflib import yapf_api |
|
136 | from yapf.yapflib import yapf_api | |
137 |
|
137 | |||
138 | style_config = file_resources.GetDefaultStyleForDir(os.getcwd()) |
|
138 | style_config = file_resources.GetDefaultStyleForDir(os.getcwd()) | |
139 | formatted_text, was_formatted = yapf_api.FormatCode( |
|
139 | formatted_text, was_formatted = yapf_api.FormatCode( | |
140 | text_before_cursor, style_config=style_config |
|
140 | text_before_cursor, style_config=style_config | |
141 | ) |
|
141 | ) | |
142 | if was_formatted: |
|
142 | if was_formatted: | |
143 | if not text_before_cursor.endswith("\n") and formatted_text.endswith("\n"): |
|
143 | if not text_before_cursor.endswith("\n") and formatted_text.endswith("\n"): | |
144 | formatted_text = formatted_text[:-1] |
|
144 | formatted_text = formatted_text[:-1] | |
145 | return formatted_text |
|
145 | return formatted_text | |
146 | else: |
|
146 | else: | |
147 | return text_before_cursor |
|
147 | return text_before_cursor | |
148 |
|
148 | |||
149 |
|
149 | |||
150 | class PtkHistoryAdapter(History): |
|
150 | class PtkHistoryAdapter(History): | |
151 | """ |
|
151 | """ | |
152 | Prompt toolkit has it's own way of handling history, Where it assumes it can |
|
152 | Prompt toolkit has it's own way of handling history, Where it assumes it can | |
153 | Push/pull from history. |
|
153 | Push/pull from history. | |
154 |
|
154 | |||
155 | """ |
|
155 | """ | |
156 |
|
156 | |||
157 | def __init__(self, shell): |
|
157 | def __init__(self, shell): | |
158 | super().__init__() |
|
158 | super().__init__() | |
159 | self.shell = shell |
|
159 | self.shell = shell | |
160 | self._refresh() |
|
160 | self._refresh() | |
161 |
|
161 | |||
162 | def append_string(self, string): |
|
162 | def append_string(self, string): | |
163 | # we rely on sql for that. |
|
163 | # we rely on sql for that. | |
164 | self._loaded = False |
|
164 | self._loaded = False | |
165 | self._refresh() |
|
165 | self._refresh() | |
166 |
|
166 | |||
167 | def _refresh(self): |
|
167 | def _refresh(self): | |
168 | if not self._loaded: |
|
168 | if not self._loaded: | |
169 | self._loaded_strings = list(self.load_history_strings()) |
|
169 | self._loaded_strings = list(self.load_history_strings()) | |
170 |
|
170 | |||
171 | def load_history_strings(self): |
|
171 | def load_history_strings(self): | |
172 | last_cell = "" |
|
172 | last_cell = "" | |
173 | res = [] |
|
173 | res = [] | |
174 | for __, ___, cell in self.shell.history_manager.get_tail( |
|
174 | for __, ___, cell in self.shell.history_manager.get_tail( | |
175 | self.shell.history_load_length, include_latest=True |
|
175 | self.shell.history_load_length, include_latest=True | |
176 | ): |
|
176 | ): | |
177 | # Ignore blank lines and consecutive duplicates |
|
177 | # Ignore blank lines and consecutive duplicates | |
178 | cell = cell.rstrip() |
|
178 | cell = cell.rstrip() | |
179 | if cell and (cell != last_cell): |
|
179 | if cell and (cell != last_cell): | |
180 | res.append(cell) |
|
180 | res.append(cell) | |
181 | last_cell = cell |
|
181 | last_cell = cell | |
182 | yield from res[::-1] |
|
182 | yield from res[::-1] | |
183 |
|
183 | |||
184 | def store_string(self, string: str) -> None: |
|
184 | def store_string(self, string: str) -> None: | |
185 | pass |
|
185 | pass | |
186 |
|
186 | |||
187 | class TerminalInteractiveShell(InteractiveShell): |
|
187 | class TerminalInteractiveShell(InteractiveShell): | |
188 | mime_renderers = Dict().tag(config=True) |
|
188 | mime_renderers = Dict().tag(config=True) | |
189 |
|
189 | |||
190 | space_for_menu = Integer(6, help='Number of line at the bottom of the screen ' |
|
190 | space_for_menu = Integer(6, help='Number of line at the bottom of the screen ' | |
191 | 'to reserve for the tab completion menu, ' |
|
191 | 'to reserve for the tab completion menu, ' | |
192 | 'search history, ...etc, the height of ' |
|
192 | 'search history, ...etc, the height of ' | |
193 | 'these menus will at most this value. ' |
|
193 | 'these menus will at most this value. ' | |
194 | 'Increase it is you prefer long and skinny ' |
|
194 | 'Increase it is you prefer long and skinny ' | |
195 | 'menus, decrease for short and wide.' |
|
195 | 'menus, decrease for short and wide.' | |
196 | ).tag(config=True) |
|
196 | ).tag(config=True) | |
197 |
|
197 | |||
198 | pt_app: UnionType[PromptSession, None] = None |
|
198 | pt_app: UnionType[PromptSession, None] = None | |
199 | auto_suggest: UnionType[ |
|
199 | auto_suggest: UnionType[ | |
200 | AutoSuggestFromHistory, NavigableAutoSuggestFromHistory, None |
|
200 | AutoSuggestFromHistory, NavigableAutoSuggestFromHistory, None | |
201 | ] = None |
|
201 | ] = None | |
202 | debugger_history = None |
|
202 | debugger_history = None | |
203 |
|
203 | |||
204 | debugger_history_file = Unicode( |
|
204 | debugger_history_file = Unicode( | |
205 | "~/.pdbhistory", help="File in which to store and read history" |
|
205 | "~/.pdbhistory", help="File in which to store and read history" | |
206 | ).tag(config=True) |
|
206 | ).tag(config=True) | |
207 |
|
207 | |||
208 | simple_prompt = Bool(_use_simple_prompt, |
|
208 | simple_prompt = Bool(_use_simple_prompt, | |
209 | help="""Use `raw_input` for the REPL, without completion and prompt colors. |
|
209 | help="""Use `raw_input` for the REPL, without completion and prompt colors. | |
210 |
|
210 | |||
211 | Useful when controlling IPython as a subprocess, and piping STDIN/OUT/ERR. Known usage are: |
|
211 | Useful when controlling IPython as a subprocess, and piping STDIN/OUT/ERR. Known usage are: | |
212 | IPython own testing machinery, and emacs inferior-shell integration through elpy. |
|
212 | IPython own testing machinery, and emacs inferior-shell integration through elpy. | |
213 |
|
213 | |||
214 | This mode default to `True` if the `IPY_TEST_SIMPLE_PROMPT` |
|
214 | This mode default to `True` if the `IPY_TEST_SIMPLE_PROMPT` | |
215 | environment variable is set, or the current terminal is not a tty.""" |
|
215 | environment variable is set, or the current terminal is not a tty.""" | |
216 | ).tag(config=True) |
|
216 | ).tag(config=True) | |
217 |
|
217 | |||
218 | @property |
|
218 | @property | |
219 | def debugger_cls(self): |
|
219 | def debugger_cls(self): | |
220 | return Pdb if self.simple_prompt else TerminalPdb |
|
220 | return Pdb if self.simple_prompt else TerminalPdb | |
221 |
|
221 | |||
222 | confirm_exit = Bool(True, |
|
222 | confirm_exit = Bool(True, | |
223 | help=""" |
|
223 | help=""" | |
224 | Set to confirm when you try to exit IPython with an EOF (Control-D |
|
224 | Set to confirm when you try to exit IPython with an EOF (Control-D | |
225 | in Unix, Control-Z/Enter in Windows). By typing 'exit' or 'quit', |
|
225 | in Unix, Control-Z/Enter in Windows). By typing 'exit' or 'quit', | |
226 | you can force a direct exit without any confirmation.""", |
|
226 | you can force a direct exit without any confirmation.""", | |
227 | ).tag(config=True) |
|
227 | ).tag(config=True) | |
228 |
|
228 | |||
229 | editing_mode = Unicode('emacs', |
|
229 | editing_mode = Unicode('emacs', | |
230 | help="Shortcut style to use at the prompt. 'vi' or 'emacs'.", |
|
230 | help="Shortcut style to use at the prompt. 'vi' or 'emacs'.", | |
231 | ).tag(config=True) |
|
231 | ).tag(config=True) | |
232 |
|
232 | |||
233 | emacs_bindings_in_vi_insert_mode = Bool( |
|
233 | emacs_bindings_in_vi_insert_mode = Bool( | |
234 | True, |
|
234 | True, | |
235 | help="Add shortcuts from 'emacs' insert mode to 'vi' insert mode.", |
|
235 | help="Add shortcuts from 'emacs' insert mode to 'vi' insert mode.", | |
236 | ).tag(config=True) |
|
236 | ).tag(config=True) | |
237 |
|
237 | |||
238 | modal_cursor = Bool( |
|
238 | modal_cursor = Bool( | |
239 | True, |
|
239 | True, | |
240 | help=""" |
|
240 | help=""" | |
241 | Cursor shape changes depending on vi mode: beam in vi insert mode, |
|
241 | Cursor shape changes depending on vi mode: beam in vi insert mode, | |
242 | block in nav mode, underscore in replace mode.""", |
|
242 | block in nav mode, underscore in replace mode.""", | |
243 | ).tag(config=True) |
|
243 | ).tag(config=True) | |
244 |
|
244 | |||
245 | ttimeoutlen = Float( |
|
245 | ttimeoutlen = Float( | |
246 | 0.01, |
|
246 | 0.01, | |
247 | help="""The time in milliseconds that is waited for a key code |
|
247 | help="""The time in milliseconds that is waited for a key code | |
248 | to complete.""", |
|
248 | to complete.""", | |
249 | ).tag(config=True) |
|
249 | ).tag(config=True) | |
250 |
|
250 | |||
251 | timeoutlen = Float( |
|
251 | timeoutlen = Float( | |
252 | 0.5, |
|
252 | 0.5, | |
253 | help="""The time in milliseconds that is waited for a mapped key |
|
253 | help="""The time in milliseconds that is waited for a mapped key | |
254 | sequence to complete.""", |
|
254 | sequence to complete.""", | |
255 | ).tag(config=True) |
|
255 | ).tag(config=True) | |
256 |
|
256 | |||
257 | autoformatter = Unicode( |
|
257 | autoformatter = Unicode( | |
258 | None, |
|
258 | None, | |
259 | help="Autoformatter to reformat Terminal code. Can be `'black'`, `'yapf'` or `None`", |
|
259 | help="Autoformatter to reformat Terminal code. Can be `'black'`, `'yapf'` or `None`", | |
260 | allow_none=True |
|
260 | allow_none=True | |
261 | ).tag(config=True) |
|
261 | ).tag(config=True) | |
262 |
|
262 | |||
263 | auto_match = Bool( |
|
263 | auto_match = Bool( | |
264 | False, |
|
264 | False, | |
265 | help=""" |
|
265 | help=""" | |
266 | Automatically add/delete closing bracket or quote when opening bracket or quote is entered/deleted. |
|
266 | Automatically add/delete closing bracket or quote when opening bracket or quote is entered/deleted. | |
267 | Brackets: (), [], {} |
|
267 | Brackets: (), [], {} | |
268 | Quotes: '', \"\" |
|
268 | Quotes: '', \"\" | |
269 | """, |
|
269 | """, | |
270 | ).tag(config=True) |
|
270 | ).tag(config=True) | |
271 |
|
271 | |||
272 | mouse_support = Bool(False, |
|
272 | mouse_support = Bool(False, | |
273 | help="Enable mouse support in the prompt\n(Note: prevents selecting text with the mouse)" |
|
273 | help="Enable mouse support in the prompt\n(Note: prevents selecting text with the mouse)" | |
274 | ).tag(config=True) |
|
274 | ).tag(config=True) | |
275 |
|
275 | |||
276 | # We don't load the list of styles for the help string, because loading |
|
276 | # We don't load the list of styles for the help string, because loading | |
277 | # Pygments plugins takes time and can cause unexpected errors. |
|
277 | # Pygments plugins takes time and can cause unexpected errors. | |
278 | highlighting_style = Union([Unicode('legacy'), Type(klass=Style)], |
|
278 | highlighting_style = Union([Unicode('legacy'), Type(klass=Style)], | |
279 | help="""The name or class of a Pygments style to use for syntax |
|
279 | help="""The name or class of a Pygments style to use for syntax | |
280 | highlighting. To see available styles, run `pygmentize -L styles`.""" |
|
280 | highlighting. To see available styles, run `pygmentize -L styles`.""" | |
281 | ).tag(config=True) |
|
281 | ).tag(config=True) | |
282 |
|
282 | |||
283 | @validate('editing_mode') |
|
283 | @validate('editing_mode') | |
284 | def _validate_editing_mode(self, proposal): |
|
284 | def _validate_editing_mode(self, proposal): | |
285 | if proposal['value'].lower() == 'vim': |
|
285 | if proposal['value'].lower() == 'vim': | |
286 | proposal['value']= 'vi' |
|
286 | proposal['value']= 'vi' | |
287 | elif proposal['value'].lower() == 'default': |
|
287 | elif proposal['value'].lower() == 'default': | |
288 | proposal['value']= 'emacs' |
|
288 | proposal['value']= 'emacs' | |
289 |
|
289 | |||
290 | if hasattr(EditingMode, proposal['value'].upper()): |
|
290 | if hasattr(EditingMode, proposal['value'].upper()): | |
291 | return proposal['value'].lower() |
|
291 | return proposal['value'].lower() | |
292 |
|
292 | |||
293 | return self.editing_mode |
|
293 | return self.editing_mode | |
294 |
|
294 | |||
295 |
|
295 | |||
296 | @observe('editing_mode') |
|
296 | @observe('editing_mode') | |
297 | def _editing_mode(self, change): |
|
297 | def _editing_mode(self, change): | |
298 | if self.pt_app: |
|
298 | if self.pt_app: | |
299 | self.pt_app.editing_mode = getattr(EditingMode, change.new.upper()) |
|
299 | self.pt_app.editing_mode = getattr(EditingMode, change.new.upper()) | |
300 |
|
300 | |||
301 | def _set_formatter(self, formatter): |
|
301 | def _set_formatter(self, formatter): | |
302 | if formatter is None: |
|
302 | if formatter is None: | |
303 | self.reformat_handler = lambda x:x |
|
303 | self.reformat_handler = lambda x:x | |
304 | elif formatter == 'black': |
|
304 | elif formatter == 'black': | |
305 | self.reformat_handler = black_reformat_handler |
|
305 | self.reformat_handler = black_reformat_handler | |
306 | elif formatter == "yapf": |
|
306 | elif formatter == "yapf": | |
307 | self.reformat_handler = yapf_reformat_handler |
|
307 | self.reformat_handler = yapf_reformat_handler | |
308 | else: |
|
308 | else: | |
309 | raise ValueError |
|
309 | raise ValueError | |
310 |
|
310 | |||
311 | @observe("autoformatter") |
|
311 | @observe("autoformatter") | |
312 | def _autoformatter_changed(self, change): |
|
312 | def _autoformatter_changed(self, change): | |
313 | formatter = change.new |
|
313 | formatter = change.new | |
314 | self._set_formatter(formatter) |
|
314 | self._set_formatter(formatter) | |
315 |
|
315 | |||
316 | @observe('highlighting_style') |
|
316 | @observe('highlighting_style') | |
317 | @observe('colors') |
|
317 | @observe('colors') | |
318 | def _highlighting_style_changed(self, change): |
|
318 | def _highlighting_style_changed(self, change): | |
319 | self.refresh_style() |
|
319 | self.refresh_style() | |
320 |
|
320 | |||
321 | def refresh_style(self): |
|
321 | def refresh_style(self): | |
322 | self._style = self._make_style_from_name_or_cls(self.highlighting_style) |
|
322 | self._style = self._make_style_from_name_or_cls(self.highlighting_style) | |
323 |
|
323 | |||
324 |
|
324 | |||
325 | highlighting_style_overrides = Dict( |
|
325 | highlighting_style_overrides = Dict( | |
326 | help="Override highlighting format for specific tokens" |
|
326 | help="Override highlighting format for specific tokens" | |
327 | ).tag(config=True) |
|
327 | ).tag(config=True) | |
328 |
|
328 | |||
329 | true_color = Bool(False, |
|
329 | true_color = Bool(False, | |
330 | help="""Use 24bit colors instead of 256 colors in prompt highlighting. |
|
330 | help="""Use 24bit colors instead of 256 colors in prompt highlighting. | |
331 | If your terminal supports true color, the following command should |
|
331 | If your terminal supports true color, the following command should | |
332 | print ``TRUECOLOR`` in orange:: |
|
332 | print ``TRUECOLOR`` in orange:: | |
333 |
|
333 | |||
334 | printf \"\\x1b[38;2;255;100;0mTRUECOLOR\\x1b[0m\\n\" |
|
334 | printf \"\\x1b[38;2;255;100;0mTRUECOLOR\\x1b[0m\\n\" | |
335 | """, |
|
335 | """, | |
336 | ).tag(config=True) |
|
336 | ).tag(config=True) | |
337 |
|
337 | |||
338 | editor = Unicode(get_default_editor(), |
|
338 | editor = Unicode(get_default_editor(), | |
339 | help="Set the editor used by IPython (default to $EDITOR/vi/notepad)." |
|
339 | help="Set the editor used by IPython (default to $EDITOR/vi/notepad)." | |
340 | ).tag(config=True) |
|
340 | ).tag(config=True) | |
341 |
|
341 | |||
342 | prompts_class = Type(Prompts, help='Class used to generate Prompt token for prompt_toolkit').tag(config=True) |
|
342 | prompts_class = Type(Prompts, help='Class used to generate Prompt token for prompt_toolkit').tag(config=True) | |
343 |
|
343 | |||
344 | prompts = Instance(Prompts) |
|
344 | prompts = Instance(Prompts) | |
345 |
|
345 | |||
346 | @default('prompts') |
|
346 | @default('prompts') | |
347 | def _prompts_default(self): |
|
347 | def _prompts_default(self): | |
348 | return self.prompts_class(self) |
|
348 | return self.prompts_class(self) | |
349 |
|
349 | |||
350 | # @observe('prompts') |
|
350 | # @observe('prompts') | |
351 | # def _(self, change): |
|
351 | # def _(self, change): | |
352 | # self._update_layout() |
|
352 | # self._update_layout() | |
353 |
|
353 | |||
354 | @default('displayhook_class') |
|
354 | @default('displayhook_class') | |
355 | def _displayhook_class_default(self): |
|
355 | def _displayhook_class_default(self): | |
356 | return RichPromptDisplayHook |
|
356 | return RichPromptDisplayHook | |
357 |
|
357 | |||
358 | term_title = Bool(True, |
|
358 | term_title = Bool(True, | |
359 | help="Automatically set the terminal title" |
|
359 | help="Automatically set the terminal title" | |
360 | ).tag(config=True) |
|
360 | ).tag(config=True) | |
361 |
|
361 | |||
362 | term_title_format = Unicode("IPython: {cwd}", |
|
362 | term_title_format = Unicode("IPython: {cwd}", | |
363 | help="Customize the terminal title format. This is a python format string. " + |
|
363 | help="Customize the terminal title format. This is a python format string. " + | |
364 | "Available substitutions are: {cwd}." |
|
364 | "Available substitutions are: {cwd}." | |
365 | ).tag(config=True) |
|
365 | ).tag(config=True) | |
366 |
|
366 | |||
367 | display_completions = Enum(('column', 'multicolumn','readlinelike'), |
|
367 | display_completions = Enum(('column', 'multicolumn','readlinelike'), | |
368 | help= ( "Options for displaying tab completions, 'column', 'multicolumn', and " |
|
368 | help= ( "Options for displaying tab completions, 'column', 'multicolumn', and " | |
369 | "'readlinelike'. These options are for `prompt_toolkit`, see " |
|
369 | "'readlinelike'. These options are for `prompt_toolkit`, see " | |
370 | "`prompt_toolkit` documentation for more information." |
|
370 | "`prompt_toolkit` documentation for more information." | |
371 | ), |
|
371 | ), | |
372 | default_value='multicolumn').tag(config=True) |
|
372 | default_value='multicolumn').tag(config=True) | |
373 |
|
373 | |||
374 | highlight_matching_brackets = Bool(True, |
|
374 | highlight_matching_brackets = Bool(True, | |
375 | help="Highlight matching brackets.", |
|
375 | help="Highlight matching brackets.", | |
376 | ).tag(config=True) |
|
376 | ).tag(config=True) | |
377 |
|
377 | |||
378 | extra_open_editor_shortcuts = Bool(False, |
|
378 | extra_open_editor_shortcuts = Bool(False, | |
379 | help="Enable vi (v) or Emacs (C-X C-E) shortcuts to open an external editor. " |
|
379 | help="Enable vi (v) or Emacs (C-X C-E) shortcuts to open an external editor. " | |
380 | "This is in addition to the F2 binding, which is always enabled." |
|
380 | "This is in addition to the F2 binding, which is always enabled." | |
381 | ).tag(config=True) |
|
381 | ).tag(config=True) | |
382 |
|
382 | |||
383 | handle_return = Any(None, |
|
383 | handle_return = Any(None, | |
384 | help="Provide an alternative handler to be called when the user presses " |
|
384 | help="Provide an alternative handler to be called when the user presses " | |
385 | "Return. This is an advanced option intended for debugging, which " |
|
385 | "Return. This is an advanced option intended for debugging, which " | |
386 | "may be changed or removed in later releases." |
|
386 | "may be changed or removed in later releases." | |
387 | ).tag(config=True) |
|
387 | ).tag(config=True) | |
388 |
|
388 | |||
389 | enable_history_search = Bool(True, |
|
389 | enable_history_search = Bool(True, | |
390 | help="Allows to enable/disable the prompt toolkit history search" |
|
390 | help="Allows to enable/disable the prompt toolkit history search" | |
391 | ).tag(config=True) |
|
391 | ).tag(config=True) | |
392 |
|
392 | |||
393 | autosuggestions_provider = Unicode( |
|
393 | autosuggestions_provider = Unicode( | |
394 | "NavigableAutoSuggestFromHistory", |
|
394 | "NavigableAutoSuggestFromHistory", | |
395 | help="Specifies from which source automatic suggestions are provided. " |
|
395 | help="Specifies from which source automatic suggestions are provided. " | |
396 | "Can be set to ``'NavigableAutoSuggestFromHistory'`` (:kbd:`up` and " |
|
396 | "Can be set to ``'NavigableAutoSuggestFromHistory'`` (:kbd:`up` and " | |
397 | ":kbd:`down` swap suggestions), ``'AutoSuggestFromHistory'``, " |
|
397 | ":kbd:`down` swap suggestions), ``'AutoSuggestFromHistory'``, " | |
398 | " or ``None`` to disable automatic suggestions. " |
|
398 | " or ``None`` to disable automatic suggestions. " | |
399 | "Default is `'NavigableAutoSuggestFromHistory`'.", |
|
399 | "Default is `'NavigableAutoSuggestFromHistory`'.", | |
400 | allow_none=True, |
|
400 | allow_none=True, | |
401 | ).tag(config=True) |
|
401 | ).tag(config=True) | |
402 |
|
402 | |||
403 | def _set_autosuggestions(self, provider): |
|
403 | def _set_autosuggestions(self, provider): | |
404 | # disconnect old handler |
|
404 | # disconnect old handler | |
405 | if self.auto_suggest and isinstance( |
|
405 | if self.auto_suggest and isinstance( | |
406 | self.auto_suggest, NavigableAutoSuggestFromHistory |
|
406 | self.auto_suggest, NavigableAutoSuggestFromHistory | |
407 | ): |
|
407 | ): | |
408 | self.auto_suggest.disconnect() |
|
408 | self.auto_suggest.disconnect() | |
409 | if provider is None: |
|
409 | if provider is None: | |
410 | self.auto_suggest = None |
|
410 | self.auto_suggest = None | |
411 | elif provider == "AutoSuggestFromHistory": |
|
411 | elif provider == "AutoSuggestFromHistory": | |
412 | self.auto_suggest = AutoSuggestFromHistory() |
|
412 | self.auto_suggest = AutoSuggestFromHistory() | |
413 | elif provider == "NavigableAutoSuggestFromHistory": |
|
413 | elif provider == "NavigableAutoSuggestFromHistory": | |
414 | self.auto_suggest = NavigableAutoSuggestFromHistory() |
|
414 | self.auto_suggest = NavigableAutoSuggestFromHistory() | |
415 | else: |
|
415 | else: | |
416 | raise ValueError("No valid provider.") |
|
416 | raise ValueError("No valid provider.") | |
417 | if self.pt_app: |
|
417 | if self.pt_app: | |
418 | self.pt_app.auto_suggest = self.auto_suggest |
|
418 | self.pt_app.auto_suggest = self.auto_suggest | |
419 |
|
419 | |||
420 | @observe("autosuggestions_provider") |
|
420 | @observe("autosuggestions_provider") | |
421 | def _autosuggestions_provider_changed(self, change): |
|
421 | def _autosuggestions_provider_changed(self, change): | |
422 | provider = change.new |
|
422 | provider = change.new | |
423 | self._set_autosuggestions(provider) |
|
423 | self._set_autosuggestions(provider) | |
424 |
|
424 | |||
425 | shortcuts = List( |
|
425 | shortcuts = List( | |
426 | trait=Dict( |
|
426 | trait=Dict( | |
427 | key_trait=Enum( |
|
427 | key_trait=Enum( | |
428 | [ |
|
428 | [ | |
429 | "command", |
|
429 | "command", | |
430 | "match_keys", |
|
430 | "match_keys", | |
431 | "match_filter", |
|
431 | "match_filter", | |
432 | "new_keys", |
|
432 | "new_keys", | |
433 | "new_filter", |
|
433 | "new_filter", | |
434 | "create", |
|
434 | "create", | |
435 | ] |
|
435 | ] | |
436 | ), |
|
436 | ), | |
437 | per_key_traits={ |
|
437 | per_key_traits={ | |
438 | "command": Unicode(), |
|
438 | "command": Unicode(), | |
439 | "match_keys": List(Unicode()), |
|
439 | "match_keys": List(Unicode()), | |
440 | "match_filter": Unicode(), |
|
440 | "match_filter": Unicode(), | |
441 | "new_keys": List(Unicode()), |
|
441 | "new_keys": List(Unicode()), | |
442 | "new_filter": Unicode(), |
|
442 | "new_filter": Unicode(), | |
443 | "create": Bool(False), |
|
443 | "create": Bool(False), | |
444 | }, |
|
444 | }, | |
445 | ), |
|
445 | ), | |
446 | help="""Add, disable or modifying shortcuts. |
|
446 | help="""Add, disable or modifying shortcuts. | |
447 |
|
447 | |||
448 | Each entry on the list should be a dictionary with ``command`` key |
|
448 | Each entry on the list should be a dictionary with ``command`` key | |
449 | identifying the target function executed by the shortcut and at least |
|
449 | identifying the target function executed by the shortcut and at least | |
450 | one of the following: |
|
450 | one of the following: | |
451 |
|
451 | |||
452 | - ``match_keys``: list of keys used to match an existing shortcut, |
|
452 | - ``match_keys``: list of keys used to match an existing shortcut, | |
453 | - ``match_filter``: shortcut filter used to match an existing shortcut, |
|
453 | - ``match_filter``: shortcut filter used to match an existing shortcut, | |
454 | - ``new_keys``: list of keys to set, |
|
454 | - ``new_keys``: list of keys to set, | |
455 | - ``new_filter``: a new shortcut filter to set |
|
455 | - ``new_filter``: a new shortcut filter to set | |
456 |
|
456 | |||
457 | The filters have to be composed of pre-defined verbs and joined by one |
|
457 | The filters have to be composed of pre-defined verbs and joined by one | |
458 | of the following conjunctions: ``&`` (and), ``|`` (or), ``~`` (not). |
|
458 | of the following conjunctions: ``&`` (and), ``|`` (or), ``~`` (not). | |
459 | The pre-defined verbs are: |
|
459 | The pre-defined verbs are: | |
460 |
|
460 | |||
461 | {} |
|
461 | {} | |
462 |
|
462 | |||
463 |
|
463 | |||
464 | To disable a shortcut set ``new_keys`` to an empty list. |
|
464 | To disable a shortcut set ``new_keys`` to an empty list. | |
465 | To add a shortcut add key ``create`` with value ``True``. |
|
465 | To add a shortcut add key ``create`` with value ``True``. | |
466 |
|
466 | |||
467 | When modifying/disabling shortcuts, ``match_keys``/``match_filter`` can |
|
467 | When modifying/disabling shortcuts, ``match_keys``/``match_filter`` can | |
468 | be omitted if the provided specification uniquely identifies a shortcut |
|
468 | be omitted if the provided specification uniquely identifies a shortcut | |
469 | to be modified/disabled. When modifying a shortcut ``new_filter`` or |
|
469 | to be modified/disabled. When modifying a shortcut ``new_filter`` or | |
470 | ``new_keys`` can be omitted which will result in reuse of the existing |
|
470 | ``new_keys`` can be omitted which will result in reuse of the existing | |
471 | filter/keys. |
|
471 | filter/keys. | |
472 |
|
472 | |||
473 | Only shortcuts defined in IPython (and not default prompt-toolkit |
|
473 | Only shortcuts defined in IPython (and not default prompt-toolkit | |
474 | shortcuts) can be modified or disabled. The full list of shortcuts, |
|
474 | shortcuts) can be modified or disabled. The full list of shortcuts, | |
475 | command identifiers and filters is available under |
|
475 | command identifiers and filters is available under | |
476 | :ref:`terminal-shortcuts-list`. |
|
476 | :ref:`terminal-shortcuts-list`. | |
477 | """.format( |
|
477 | """.format( | |
478 | "\n ".join([f"- `{k}`" for k in KEYBINDING_FILTERS]) |
|
478 | "\n ".join([f"- `{k}`" for k in KEYBINDING_FILTERS]) | |
479 | ), |
|
479 | ), | |
480 | ).tag(config=True) |
|
480 | ).tag(config=True) | |
481 |
|
481 | |||
482 | @observe("shortcuts") |
|
482 | @observe("shortcuts") | |
483 | def _shortcuts_changed(self, change): |
|
483 | def _shortcuts_changed(self, change): | |
484 | if self.pt_app: |
|
484 | if self.pt_app: | |
485 | self.pt_app.key_bindings = self._merge_shortcuts(user_shortcuts=change.new) |
|
485 | self.pt_app.key_bindings = self._merge_shortcuts(user_shortcuts=change.new) | |
486 |
|
486 | |||
487 | def _merge_shortcuts(self, user_shortcuts): |
|
487 | def _merge_shortcuts(self, user_shortcuts): | |
488 | # rebuild the bindings list from scratch |
|
488 | # rebuild the bindings list from scratch | |
489 | key_bindings = create_ipython_shortcuts(self) |
|
489 | key_bindings = create_ipython_shortcuts(self) | |
490 |
|
490 | |||
491 | # for now we only allow adding shortcuts for commands which are already |
|
491 | # for now we only allow adding shortcuts for commands which are already | |
492 | # registered; this is a security precaution. |
|
492 | # registered; this is a security precaution. | |
493 | known_commands = { |
|
493 | known_commands = { | |
494 | create_identifier(binding.handler): binding.handler |
|
494 | create_identifier(binding.handler): binding.handler | |
495 | for binding in key_bindings.bindings |
|
495 | for binding in key_bindings.bindings | |
496 | } |
|
496 | } | |
497 | shortcuts_to_skip = [] |
|
497 | shortcuts_to_skip = [] | |
498 | shortcuts_to_add = [] |
|
498 | shortcuts_to_add = [] | |
499 |
|
499 | |||
500 | for shortcut in user_shortcuts: |
|
500 | for shortcut in user_shortcuts: | |
501 | command_id = shortcut["command"] |
|
501 | command_id = shortcut["command"] | |
502 | if command_id not in known_commands: |
|
502 | if command_id not in known_commands: | |
503 | allowed_commands = "\n - ".join(known_commands) |
|
503 | allowed_commands = "\n - ".join(known_commands) | |
504 | raise ValueError( |
|
504 | raise ValueError( | |
505 | f"{command_id} is not a known shortcut command." |
|
505 | f"{command_id} is not a known shortcut command." | |
506 | f" Allowed commands are: \n - {allowed_commands}" |
|
506 | f" Allowed commands are: \n - {allowed_commands}" | |
507 | ) |
|
507 | ) | |
508 | old_keys = shortcut.get("match_keys", None) |
|
508 | old_keys = shortcut.get("match_keys", None) | |
509 | old_filter = ( |
|
509 | old_filter = ( | |
510 | filter_from_string(shortcut["match_filter"]) |
|
510 | filter_from_string(shortcut["match_filter"]) | |
511 | if "match_filter" in shortcut |
|
511 | if "match_filter" in shortcut | |
512 | else None |
|
512 | else None | |
513 | ) |
|
513 | ) | |
514 | matching = [ |
|
514 | matching = [ | |
515 | binding |
|
515 | binding | |
516 | for binding in key_bindings.bindings |
|
516 | for binding in key_bindings.bindings | |
517 | if ( |
|
517 | if ( | |
518 | (old_filter is None or binding.filter == old_filter) |
|
518 | (old_filter is None or binding.filter == old_filter) | |
519 | and (old_keys is None or [k for k in binding.keys] == old_keys) |
|
519 | and (old_keys is None or [k for k in binding.keys] == old_keys) | |
520 | and create_identifier(binding.handler) == command_id |
|
520 | and create_identifier(binding.handler) == command_id | |
521 | ) |
|
521 | ) | |
522 | ] |
|
522 | ] | |
523 |
|
523 | |||
524 | new_keys = shortcut.get("new_keys", None) |
|
524 | new_keys = shortcut.get("new_keys", None) | |
525 | new_filter = shortcut.get("new_filter", None) |
|
525 | new_filter = shortcut.get("new_filter", None) | |
526 |
|
526 | |||
527 | command = known_commands[command_id] |
|
527 | command = known_commands[command_id] | |
528 |
|
528 | |||
529 | creating_new = shortcut.get("create", False) |
|
529 | creating_new = shortcut.get("create", False) | |
530 | modifying_existing = not creating_new and ( |
|
530 | modifying_existing = not creating_new and ( | |
531 | new_keys is not None or new_filter |
|
531 | new_keys is not None or new_filter | |
532 | ) |
|
532 | ) | |
533 |
|
533 | |||
534 | if creating_new and new_keys == []: |
|
534 | if creating_new and new_keys == []: | |
535 | raise ValueError("Cannot add a shortcut without keys") |
|
535 | raise ValueError("Cannot add a shortcut without keys") | |
536 |
|
536 | |||
537 | if modifying_existing: |
|
537 | if modifying_existing: | |
538 | specification = { |
|
538 | specification = { | |
539 | key: shortcut[key] |
|
539 | key: shortcut[key] | |
540 | for key in ["command", "filter"] |
|
540 | for key in ["command", "filter"] | |
541 | if key in shortcut |
|
541 | if key in shortcut | |
542 | } |
|
542 | } | |
543 | if len(matching) == 0: |
|
543 | if len(matching) == 0: | |
544 |
raise ValueError( |
|
544 | raise ValueError( | |
|
545 | f"No shortcuts matching {specification} found in {key_bindings.bindings}" | |||
|
546 | ) | |||
545 | elif len(matching) > 1: |
|
547 | elif len(matching) > 1: | |
546 | raise ValueError( |
|
548 | raise ValueError( | |
547 | f"Multiple shortcuts matching {specification} found," |
|
549 | f"Multiple shortcuts matching {specification} found," | |
548 | f" please add keys/filter to select one of: {matching}" |
|
550 | f" please add keys/filter to select one of: {matching}" | |
549 | ) |
|
551 | ) | |
550 |
|
552 | |||
551 | matched = matching[0] |
|
553 | matched = matching[0] | |
552 | old_filter = matched.filter |
|
554 | old_filter = matched.filter | |
553 | old_keys = list(matched.keys) |
|
555 | old_keys = list(matched.keys) | |
554 | shortcuts_to_skip.append( |
|
556 | shortcuts_to_skip.append( | |
555 | RuntimeBinding( |
|
557 | RuntimeBinding( | |
556 | command, |
|
558 | command, | |
557 | keys=old_keys, |
|
559 | keys=old_keys, | |
558 | filter=old_filter, |
|
560 | filter=old_filter, | |
559 | ) |
|
561 | ) | |
560 | ) |
|
562 | ) | |
561 |
|
563 | |||
562 | if new_keys != []: |
|
564 | if new_keys != []: | |
563 | shortcuts_to_add.append( |
|
565 | shortcuts_to_add.append( | |
564 | RuntimeBinding( |
|
566 | RuntimeBinding( | |
565 | command, |
|
567 | command, | |
566 | keys=new_keys or old_keys, |
|
568 | keys=new_keys or old_keys, | |
567 | filter=filter_from_string(new_filter) |
|
569 | filter=filter_from_string(new_filter) | |
568 | if new_filter is not None |
|
570 | if new_filter is not None | |
569 | else ( |
|
571 | else ( | |
570 | old_filter |
|
572 | old_filter | |
571 | if old_filter is not None |
|
573 | if old_filter is not None | |
572 | else filter_from_string("always") |
|
574 | else filter_from_string("always") | |
573 | ), |
|
575 | ), | |
574 | ) |
|
576 | ) | |
575 | ) |
|
577 | ) | |
576 |
|
578 | |||
577 | # rebuild the bindings list from scratch |
|
579 | # rebuild the bindings list from scratch | |
578 | key_bindings = create_ipython_shortcuts(self, skip=shortcuts_to_skip) |
|
580 | key_bindings = create_ipython_shortcuts(self, skip=shortcuts_to_skip) | |
579 | for binding in shortcuts_to_add: |
|
581 | for binding in shortcuts_to_add: | |
580 | add_binding(key_bindings, binding) |
|
582 | add_binding(key_bindings, binding) | |
581 |
|
583 | |||
582 | return key_bindings |
|
584 | return key_bindings | |
583 |
|
585 | |||
584 | prompt_includes_vi_mode = Bool(True, |
|
586 | prompt_includes_vi_mode = Bool(True, | |
585 | help="Display the current vi mode (when using vi editing mode)." |
|
587 | help="Display the current vi mode (when using vi editing mode)." | |
586 | ).tag(config=True) |
|
588 | ).tag(config=True) | |
587 |
|
589 | |||
588 | @observe('term_title') |
|
590 | @observe('term_title') | |
589 | def init_term_title(self, change=None): |
|
591 | def init_term_title(self, change=None): | |
590 | # Enable or disable the terminal title. |
|
592 | # Enable or disable the terminal title. | |
591 | if self.term_title and _is_tty: |
|
593 | if self.term_title and _is_tty: | |
592 | toggle_set_term_title(True) |
|
594 | toggle_set_term_title(True) | |
593 | set_term_title(self.term_title_format.format(cwd=abbrev_cwd())) |
|
595 | set_term_title(self.term_title_format.format(cwd=abbrev_cwd())) | |
594 | else: |
|
596 | else: | |
595 | toggle_set_term_title(False) |
|
597 | toggle_set_term_title(False) | |
596 |
|
598 | |||
597 | def restore_term_title(self): |
|
599 | def restore_term_title(self): | |
598 | if self.term_title and _is_tty: |
|
600 | if self.term_title and _is_tty: | |
599 | restore_term_title() |
|
601 | restore_term_title() | |
600 |
|
602 | |||
601 | def init_display_formatter(self): |
|
603 | def init_display_formatter(self): | |
602 | super(TerminalInteractiveShell, self).init_display_formatter() |
|
604 | super(TerminalInteractiveShell, self).init_display_formatter() | |
603 | # terminal only supports plain text |
|
605 | # terminal only supports plain text | |
604 | self.display_formatter.active_types = ["text/plain"] |
|
606 | self.display_formatter.active_types = ["text/plain"] | |
605 |
|
607 | |||
606 | def init_prompt_toolkit_cli(self): |
|
608 | def init_prompt_toolkit_cli(self): | |
607 | if self.simple_prompt: |
|
609 | if self.simple_prompt: | |
608 | # Fall back to plain non-interactive output for tests. |
|
610 | # Fall back to plain non-interactive output for tests. | |
609 | # This is very limited. |
|
611 | # This is very limited. | |
610 | def prompt(): |
|
612 | def prompt(): | |
611 | prompt_text = "".join(x[1] for x in self.prompts.in_prompt_tokens()) |
|
613 | prompt_text = "".join(x[1] for x in self.prompts.in_prompt_tokens()) | |
612 | lines = [input(prompt_text)] |
|
614 | lines = [input(prompt_text)] | |
613 | prompt_continuation = "".join(x[1] for x in self.prompts.continuation_prompt_tokens()) |
|
615 | prompt_continuation = "".join(x[1] for x in self.prompts.continuation_prompt_tokens()) | |
614 | while self.check_complete('\n'.join(lines))[0] == 'incomplete': |
|
616 | while self.check_complete('\n'.join(lines))[0] == 'incomplete': | |
615 | lines.append( input(prompt_continuation) ) |
|
617 | lines.append( input(prompt_continuation) ) | |
616 | return '\n'.join(lines) |
|
618 | return '\n'.join(lines) | |
617 | self.prompt_for_code = prompt |
|
619 | self.prompt_for_code = prompt | |
618 | return |
|
620 | return | |
619 |
|
621 | |||
620 | # Set up keyboard shortcuts |
|
622 | # Set up keyboard shortcuts | |
621 | key_bindings = self._merge_shortcuts(user_shortcuts=self.shortcuts) |
|
623 | key_bindings = self._merge_shortcuts(user_shortcuts=self.shortcuts) | |
622 |
|
624 | |||
623 | # Pre-populate history from IPython's history database |
|
625 | # Pre-populate history from IPython's history database | |
624 | history = PtkHistoryAdapter(self) |
|
626 | history = PtkHistoryAdapter(self) | |
625 |
|
627 | |||
626 | self._style = self._make_style_from_name_or_cls(self.highlighting_style) |
|
628 | self._style = self._make_style_from_name_or_cls(self.highlighting_style) | |
627 | self.style = DynamicStyle(lambda: self._style) |
|
629 | self.style = DynamicStyle(lambda: self._style) | |
628 |
|
630 | |||
629 | editing_mode = getattr(EditingMode, self.editing_mode.upper()) |
|
631 | editing_mode = getattr(EditingMode, self.editing_mode.upper()) | |
630 |
|
632 | |||
631 | self.pt_loop = asyncio.new_event_loop() |
|
633 | self.pt_loop = asyncio.new_event_loop() | |
632 | self.pt_app = PromptSession( |
|
634 | self.pt_app = PromptSession( | |
633 | auto_suggest=self.auto_suggest, |
|
635 | auto_suggest=self.auto_suggest, | |
634 | editing_mode=editing_mode, |
|
636 | editing_mode=editing_mode, | |
635 | key_bindings=key_bindings, |
|
637 | key_bindings=key_bindings, | |
636 | history=history, |
|
638 | history=history, | |
637 | completer=IPythonPTCompleter(shell=self), |
|
639 | completer=IPythonPTCompleter(shell=self), | |
638 | enable_history_search=self.enable_history_search, |
|
640 | enable_history_search=self.enable_history_search, | |
639 | style=self.style, |
|
641 | style=self.style, | |
640 | include_default_pygments_style=False, |
|
642 | include_default_pygments_style=False, | |
641 | mouse_support=self.mouse_support, |
|
643 | mouse_support=self.mouse_support, | |
642 | enable_open_in_editor=self.extra_open_editor_shortcuts, |
|
644 | enable_open_in_editor=self.extra_open_editor_shortcuts, | |
643 | color_depth=self.color_depth, |
|
645 | color_depth=self.color_depth, | |
644 | tempfile_suffix=".py", |
|
646 | tempfile_suffix=".py", | |
645 | **self._extra_prompt_options(), |
|
647 | **self._extra_prompt_options(), | |
646 | ) |
|
648 | ) | |
647 | if isinstance(self.auto_suggest, NavigableAutoSuggestFromHistory): |
|
649 | if isinstance(self.auto_suggest, NavigableAutoSuggestFromHistory): | |
648 | self.auto_suggest.connect(self.pt_app) |
|
650 | self.auto_suggest.connect(self.pt_app) | |
649 |
|
651 | |||
650 | def _make_style_from_name_or_cls(self, name_or_cls): |
|
652 | def _make_style_from_name_or_cls(self, name_or_cls): | |
651 | """ |
|
653 | """ | |
652 | Small wrapper that make an IPython compatible style from a style name |
|
654 | Small wrapper that make an IPython compatible style from a style name | |
653 |
|
655 | |||
654 | We need that to add style for prompt ... etc. |
|
656 | We need that to add style for prompt ... etc. | |
655 | """ |
|
657 | """ | |
656 | style_overrides = {} |
|
658 | style_overrides = {} | |
657 | if name_or_cls == 'legacy': |
|
659 | if name_or_cls == 'legacy': | |
658 | legacy = self.colors.lower() |
|
660 | legacy = self.colors.lower() | |
659 | if legacy == 'linux': |
|
661 | if legacy == 'linux': | |
660 | style_cls = get_style_by_name('monokai') |
|
662 | style_cls = get_style_by_name('monokai') | |
661 | style_overrides = _style_overrides_linux |
|
663 | style_overrides = _style_overrides_linux | |
662 | elif legacy == 'lightbg': |
|
664 | elif legacy == 'lightbg': | |
663 | style_overrides = _style_overrides_light_bg |
|
665 | style_overrides = _style_overrides_light_bg | |
664 | style_cls = get_style_by_name('pastie') |
|
666 | style_cls = get_style_by_name('pastie') | |
665 | elif legacy == 'neutral': |
|
667 | elif legacy == 'neutral': | |
666 | # The default theme needs to be visible on both a dark background |
|
668 | # The default theme needs to be visible on both a dark background | |
667 | # and a light background, because we can't tell what the terminal |
|
669 | # and a light background, because we can't tell what the terminal | |
668 | # looks like. These tweaks to the default theme help with that. |
|
670 | # looks like. These tweaks to the default theme help with that. | |
669 | style_cls = get_style_by_name('default') |
|
671 | style_cls = get_style_by_name('default') | |
670 | style_overrides.update({ |
|
672 | style_overrides.update({ | |
671 | Token.Number: '#ansigreen', |
|
673 | Token.Number: '#ansigreen', | |
672 | Token.Operator: 'noinherit', |
|
674 | Token.Operator: 'noinherit', | |
673 | Token.String: '#ansiyellow', |
|
675 | Token.String: '#ansiyellow', | |
674 | Token.Name.Function: '#ansiblue', |
|
676 | Token.Name.Function: '#ansiblue', | |
675 | Token.Name.Class: 'bold #ansiblue', |
|
677 | Token.Name.Class: 'bold #ansiblue', | |
676 | Token.Name.Namespace: 'bold #ansiblue', |
|
678 | Token.Name.Namespace: 'bold #ansiblue', | |
677 | Token.Name.Variable.Magic: '#ansiblue', |
|
679 | Token.Name.Variable.Magic: '#ansiblue', | |
678 | Token.Prompt: '#ansigreen', |
|
680 | Token.Prompt: '#ansigreen', | |
679 | Token.PromptNum: '#ansibrightgreen bold', |
|
681 | Token.PromptNum: '#ansibrightgreen bold', | |
680 | Token.OutPrompt: '#ansired', |
|
682 | Token.OutPrompt: '#ansired', | |
681 | Token.OutPromptNum: '#ansibrightred bold', |
|
683 | Token.OutPromptNum: '#ansibrightred bold', | |
682 | }) |
|
684 | }) | |
683 |
|
685 | |||
684 | # Hack: Due to limited color support on the Windows console |
|
686 | # Hack: Due to limited color support on the Windows console | |
685 | # the prompt colors will be wrong without this |
|
687 | # the prompt colors will be wrong without this | |
686 | if os.name == 'nt': |
|
688 | if os.name == 'nt': | |
687 | style_overrides.update({ |
|
689 | style_overrides.update({ | |
688 | Token.Prompt: '#ansidarkgreen', |
|
690 | Token.Prompt: '#ansidarkgreen', | |
689 | Token.PromptNum: '#ansigreen bold', |
|
691 | Token.PromptNum: '#ansigreen bold', | |
690 | Token.OutPrompt: '#ansidarkred', |
|
692 | Token.OutPrompt: '#ansidarkred', | |
691 | Token.OutPromptNum: '#ansired bold', |
|
693 | Token.OutPromptNum: '#ansired bold', | |
692 | }) |
|
694 | }) | |
693 | elif legacy =='nocolor': |
|
695 | elif legacy =='nocolor': | |
694 | style_cls=_NoStyle |
|
696 | style_cls=_NoStyle | |
695 | style_overrides = {} |
|
697 | style_overrides = {} | |
696 | else : |
|
698 | else : | |
697 | raise ValueError('Got unknown colors: ', legacy) |
|
699 | raise ValueError('Got unknown colors: ', legacy) | |
698 | else : |
|
700 | else : | |
699 | if isinstance(name_or_cls, str): |
|
701 | if isinstance(name_or_cls, str): | |
700 | style_cls = get_style_by_name(name_or_cls) |
|
702 | style_cls = get_style_by_name(name_or_cls) | |
701 | else: |
|
703 | else: | |
702 | style_cls = name_or_cls |
|
704 | style_cls = name_or_cls | |
703 | style_overrides = { |
|
705 | style_overrides = { | |
704 | Token.Prompt: '#ansigreen', |
|
706 | Token.Prompt: '#ansigreen', | |
705 | Token.PromptNum: '#ansibrightgreen bold', |
|
707 | Token.PromptNum: '#ansibrightgreen bold', | |
706 | Token.OutPrompt: '#ansired', |
|
708 | Token.OutPrompt: '#ansired', | |
707 | Token.OutPromptNum: '#ansibrightred bold', |
|
709 | Token.OutPromptNum: '#ansibrightred bold', | |
708 | } |
|
710 | } | |
709 | style_overrides.update(self.highlighting_style_overrides) |
|
711 | style_overrides.update(self.highlighting_style_overrides) | |
710 | style = merge_styles([ |
|
712 | style = merge_styles([ | |
711 | style_from_pygments_cls(style_cls), |
|
713 | style_from_pygments_cls(style_cls), | |
712 | style_from_pygments_dict(style_overrides), |
|
714 | style_from_pygments_dict(style_overrides), | |
713 | ]) |
|
715 | ]) | |
714 |
|
716 | |||
715 | return style |
|
717 | return style | |
716 |
|
718 | |||
717 | @property |
|
719 | @property | |
718 | def pt_complete_style(self): |
|
720 | def pt_complete_style(self): | |
719 | return { |
|
721 | return { | |
720 | 'multicolumn': CompleteStyle.MULTI_COLUMN, |
|
722 | 'multicolumn': CompleteStyle.MULTI_COLUMN, | |
721 | 'column': CompleteStyle.COLUMN, |
|
723 | 'column': CompleteStyle.COLUMN, | |
722 | 'readlinelike': CompleteStyle.READLINE_LIKE, |
|
724 | 'readlinelike': CompleteStyle.READLINE_LIKE, | |
723 | }[self.display_completions] |
|
725 | }[self.display_completions] | |
724 |
|
726 | |||
725 | @property |
|
727 | @property | |
726 | def color_depth(self): |
|
728 | def color_depth(self): | |
727 | return (ColorDepth.TRUE_COLOR if self.true_color else None) |
|
729 | return (ColorDepth.TRUE_COLOR if self.true_color else None) | |
728 |
|
730 | |||
729 | def _extra_prompt_options(self): |
|
731 | def _extra_prompt_options(self): | |
730 | """ |
|
732 | """ | |
731 | Return the current layout option for the current Terminal InteractiveShell |
|
733 | Return the current layout option for the current Terminal InteractiveShell | |
732 | """ |
|
734 | """ | |
733 | def get_message(): |
|
735 | def get_message(): | |
734 | return PygmentsTokens(self.prompts.in_prompt_tokens()) |
|
736 | return PygmentsTokens(self.prompts.in_prompt_tokens()) | |
735 |
|
737 | |||
736 | if self.editing_mode == 'emacs': |
|
738 | if self.editing_mode == 'emacs': | |
737 | # with emacs mode the prompt is (usually) static, so we call only |
|
739 | # with emacs mode the prompt is (usually) static, so we call only | |
738 | # the function once. With VI mode it can toggle between [ins] and |
|
740 | # the function once. With VI mode it can toggle between [ins] and | |
739 | # [nor] so we can't precompute. |
|
741 | # [nor] so we can't precompute. | |
740 | # here I'm going to favor the default keybinding which almost |
|
742 | # here I'm going to favor the default keybinding which almost | |
741 | # everybody uses to decrease CPU usage. |
|
743 | # everybody uses to decrease CPU usage. | |
742 | # if we have issues with users with custom Prompts we can see how to |
|
744 | # if we have issues with users with custom Prompts we can see how to | |
743 | # work around this. |
|
745 | # work around this. | |
744 | get_message = get_message() |
|
746 | get_message = get_message() | |
745 |
|
747 | |||
746 | options = { |
|
748 | options = { | |
747 | "complete_in_thread": False, |
|
749 | "complete_in_thread": False, | |
748 | "lexer": IPythonPTLexer(), |
|
750 | "lexer": IPythonPTLexer(), | |
749 | "reserve_space_for_menu": self.space_for_menu, |
|
751 | "reserve_space_for_menu": self.space_for_menu, | |
750 | "message": get_message, |
|
752 | "message": get_message, | |
751 | "prompt_continuation": ( |
|
753 | "prompt_continuation": ( | |
752 | lambda width, lineno, is_soft_wrap: PygmentsTokens( |
|
754 | lambda width, lineno, is_soft_wrap: PygmentsTokens( | |
753 | self.prompts.continuation_prompt_tokens(width) |
|
755 | self.prompts.continuation_prompt_tokens(width) | |
754 | ) |
|
756 | ) | |
755 | ), |
|
757 | ), | |
756 | "multiline": True, |
|
758 | "multiline": True, | |
757 | "complete_style": self.pt_complete_style, |
|
759 | "complete_style": self.pt_complete_style, | |
758 | "input_processors": [ |
|
760 | "input_processors": [ | |
759 | # Highlight matching brackets, but only when this setting is |
|
761 | # Highlight matching brackets, but only when this setting is | |
760 | # enabled, and only when the DEFAULT_BUFFER has the focus. |
|
762 | # enabled, and only when the DEFAULT_BUFFER has the focus. | |
761 | ConditionalProcessor( |
|
763 | ConditionalProcessor( | |
762 | processor=HighlightMatchingBracketProcessor(chars="[](){}"), |
|
764 | processor=HighlightMatchingBracketProcessor(chars="[](){}"), | |
763 | filter=HasFocus(DEFAULT_BUFFER) |
|
765 | filter=HasFocus(DEFAULT_BUFFER) | |
764 | & ~IsDone() |
|
766 | & ~IsDone() | |
765 | & Condition(lambda: self.highlight_matching_brackets), |
|
767 | & Condition(lambda: self.highlight_matching_brackets), | |
766 | ), |
|
768 | ), | |
767 | # Show auto-suggestion in lines other than the last line. |
|
769 | # Show auto-suggestion in lines other than the last line. | |
768 | ConditionalProcessor( |
|
770 | ConditionalProcessor( | |
769 | processor=AppendAutoSuggestionInAnyLine(), |
|
771 | processor=AppendAutoSuggestionInAnyLine(), | |
770 | filter=HasFocus(DEFAULT_BUFFER) |
|
772 | filter=HasFocus(DEFAULT_BUFFER) | |
771 | & ~IsDone() |
|
773 | & ~IsDone() | |
772 | & Condition( |
|
774 | & Condition( | |
773 | lambda: isinstance( |
|
775 | lambda: isinstance( | |
774 | self.auto_suggest, NavigableAutoSuggestFromHistory |
|
776 | self.auto_suggest, NavigableAutoSuggestFromHistory | |
775 | ) |
|
777 | ) | |
776 | ), |
|
778 | ), | |
777 | ), |
|
779 | ), | |
778 | ], |
|
780 | ], | |
779 | } |
|
781 | } | |
780 | if not PTK3: |
|
782 | if not PTK3: | |
781 | options['inputhook'] = self.inputhook |
|
783 | options['inputhook'] = self.inputhook | |
782 |
|
784 | |||
783 | return options |
|
785 | return options | |
784 |
|
786 | |||
785 | def prompt_for_code(self): |
|
787 | def prompt_for_code(self): | |
786 | if self.rl_next_input: |
|
788 | if self.rl_next_input: | |
787 | default = self.rl_next_input |
|
789 | default = self.rl_next_input | |
788 | self.rl_next_input = None |
|
790 | self.rl_next_input = None | |
789 | else: |
|
791 | else: | |
790 | default = '' |
|
792 | default = '' | |
791 |
|
793 | |||
792 | # In order to make sure that asyncio code written in the |
|
794 | # In order to make sure that asyncio code written in the | |
793 | # interactive shell doesn't interfere with the prompt, we run the |
|
795 | # interactive shell doesn't interfere with the prompt, we run the | |
794 | # prompt in a different event loop. |
|
796 | # prompt in a different event loop. | |
795 | # If we don't do this, people could spawn coroutine with a |
|
797 | # If we don't do this, people could spawn coroutine with a | |
796 | # while/true inside which will freeze the prompt. |
|
798 | # while/true inside which will freeze the prompt. | |
797 |
|
799 | |||
798 | policy = asyncio.get_event_loop_policy() |
|
800 | policy = asyncio.get_event_loop_policy() | |
799 | old_loop = get_asyncio_loop() |
|
801 | old_loop = get_asyncio_loop() | |
800 |
|
802 | |||
801 | # FIXME: prompt_toolkit is using the deprecated `asyncio.get_event_loop` |
|
803 | # FIXME: prompt_toolkit is using the deprecated `asyncio.get_event_loop` | |
802 | # to get the current event loop. |
|
804 | # to get the current event loop. | |
803 | # This will probably be replaced by an attribute or input argument, |
|
805 | # This will probably be replaced by an attribute or input argument, | |
804 | # at which point we can stop calling the soon-to-be-deprecated `set_event_loop` here. |
|
806 | # at which point we can stop calling the soon-to-be-deprecated `set_event_loop` here. | |
805 | if old_loop is not self.pt_loop: |
|
807 | if old_loop is not self.pt_loop: | |
806 | policy.set_event_loop(self.pt_loop) |
|
808 | policy.set_event_loop(self.pt_loop) | |
807 | try: |
|
809 | try: | |
808 | with patch_stdout(raw=True): |
|
810 | with patch_stdout(raw=True): | |
809 | text = self.pt_app.prompt( |
|
811 | text = self.pt_app.prompt( | |
810 | default=default, |
|
812 | default=default, | |
811 | **self._extra_prompt_options()) |
|
813 | **self._extra_prompt_options()) | |
812 | finally: |
|
814 | finally: | |
813 | # Restore the original event loop. |
|
815 | # Restore the original event loop. | |
814 | if old_loop is not None and old_loop is not self.pt_loop: |
|
816 | if old_loop is not None and old_loop is not self.pt_loop: | |
815 | policy.set_event_loop(old_loop) |
|
817 | policy.set_event_loop(old_loop) | |
816 |
|
818 | |||
817 | return text |
|
819 | return text | |
818 |
|
820 | |||
819 | def enable_win_unicode_console(self): |
|
821 | def enable_win_unicode_console(self): | |
820 | # Since IPython 7.10 doesn't support python < 3.6 and PEP 528, Python uses the unicode APIs for the Windows |
|
822 | # Since IPython 7.10 doesn't support python < 3.6 and PEP 528, Python uses the unicode APIs for the Windows | |
821 | # console by default, so WUC shouldn't be needed. |
|
823 | # console by default, so WUC shouldn't be needed. | |
822 | warn("`enable_win_unicode_console` is deprecated since IPython 7.10, does not do anything and will be removed in the future", |
|
824 | warn("`enable_win_unicode_console` is deprecated since IPython 7.10, does not do anything and will be removed in the future", | |
823 | DeprecationWarning, |
|
825 | DeprecationWarning, | |
824 | stacklevel=2) |
|
826 | stacklevel=2) | |
825 |
|
827 | |||
826 | def init_io(self): |
|
828 | def init_io(self): | |
827 | if sys.platform not in {'win32', 'cli'}: |
|
829 | if sys.platform not in {'win32', 'cli'}: | |
828 | return |
|
830 | return | |
829 |
|
831 | |||
830 | import colorama |
|
832 | import colorama | |
831 | colorama.init() |
|
833 | colorama.init() | |
832 |
|
834 | |||
833 | def init_magics(self): |
|
835 | def init_magics(self): | |
834 | super(TerminalInteractiveShell, self).init_magics() |
|
836 | super(TerminalInteractiveShell, self).init_magics() | |
835 | self.register_magics(TerminalMagics) |
|
837 | self.register_magics(TerminalMagics) | |
836 |
|
838 | |||
837 | def init_alias(self): |
|
839 | def init_alias(self): | |
838 | # The parent class defines aliases that can be safely used with any |
|
840 | # The parent class defines aliases that can be safely used with any | |
839 | # frontend. |
|
841 | # frontend. | |
840 | super(TerminalInteractiveShell, self).init_alias() |
|
842 | super(TerminalInteractiveShell, self).init_alias() | |
841 |
|
843 | |||
842 | # Now define aliases that only make sense on the terminal, because they |
|
844 | # Now define aliases that only make sense on the terminal, because they | |
843 | # need direct access to the console in a way that we can't emulate in |
|
845 | # need direct access to the console in a way that we can't emulate in | |
844 | # GUI or web frontend |
|
846 | # GUI or web frontend | |
845 | if os.name == 'posix': |
|
847 | if os.name == 'posix': | |
846 | for cmd in ('clear', 'more', 'less', 'man'): |
|
848 | for cmd in ('clear', 'more', 'less', 'man'): | |
847 | self.alias_manager.soft_define_alias(cmd, cmd) |
|
849 | self.alias_manager.soft_define_alias(cmd, cmd) | |
848 |
|
850 | |||
849 |
|
851 | |||
850 | def __init__(self, *args, **kwargs) -> None: |
|
852 | def __init__(self, *args, **kwargs) -> None: | |
851 | super(TerminalInteractiveShell, self).__init__(*args, **kwargs) |
|
853 | super(TerminalInteractiveShell, self).__init__(*args, **kwargs) | |
852 | self._set_autosuggestions(self.autosuggestions_provider) |
|
854 | self._set_autosuggestions(self.autosuggestions_provider) | |
853 | self.init_prompt_toolkit_cli() |
|
855 | self.init_prompt_toolkit_cli() | |
854 | self.init_term_title() |
|
856 | self.init_term_title() | |
855 | self.keep_running = True |
|
857 | self.keep_running = True | |
856 | self._set_formatter(self.autoformatter) |
|
858 | self._set_formatter(self.autoformatter) | |
857 |
|
859 | |||
858 |
|
860 | |||
859 | def ask_exit(self): |
|
861 | def ask_exit(self): | |
860 | self.keep_running = False |
|
862 | self.keep_running = False | |
861 |
|
863 | |||
862 | rl_next_input = None |
|
864 | rl_next_input = None | |
863 |
|
865 | |||
864 | def interact(self): |
|
866 | def interact(self): | |
865 | self.keep_running = True |
|
867 | self.keep_running = True | |
866 | while self.keep_running: |
|
868 | while self.keep_running: | |
867 | print(self.separate_in, end='') |
|
869 | print(self.separate_in, end='') | |
868 |
|
870 | |||
869 | try: |
|
871 | try: | |
870 | code = self.prompt_for_code() |
|
872 | code = self.prompt_for_code() | |
871 | except EOFError: |
|
873 | except EOFError: | |
872 | if (not self.confirm_exit) \ |
|
874 | if (not self.confirm_exit) \ | |
873 | or self.ask_yes_no('Do you really want to exit ([y]/n)?','y','n'): |
|
875 | or self.ask_yes_no('Do you really want to exit ([y]/n)?','y','n'): | |
874 | self.ask_exit() |
|
876 | self.ask_exit() | |
875 |
|
877 | |||
876 | else: |
|
878 | else: | |
877 | if code: |
|
879 | if code: | |
878 | self.run_cell(code, store_history=True) |
|
880 | self.run_cell(code, store_history=True) | |
879 |
|
881 | |||
880 | def mainloop(self): |
|
882 | def mainloop(self): | |
881 | # An extra layer of protection in case someone mashing Ctrl-C breaks |
|
883 | # An extra layer of protection in case someone mashing Ctrl-C breaks | |
882 | # out of our internal code. |
|
884 | # out of our internal code. | |
883 | while True: |
|
885 | while True: | |
884 | try: |
|
886 | try: | |
885 | self.interact() |
|
887 | self.interact() | |
886 | break |
|
888 | break | |
887 | except KeyboardInterrupt as e: |
|
889 | except KeyboardInterrupt as e: | |
888 | print("\n%s escaped interact()\n" % type(e).__name__) |
|
890 | print("\n%s escaped interact()\n" % type(e).__name__) | |
889 | finally: |
|
891 | finally: | |
890 | # An interrupt during the eventloop will mess up the |
|
892 | # An interrupt during the eventloop will mess up the | |
891 | # internal state of the prompt_toolkit library. |
|
893 | # internal state of the prompt_toolkit library. | |
892 | # Stopping the eventloop fixes this, see |
|
894 | # Stopping the eventloop fixes this, see | |
893 | # https://github.com/ipython/ipython/pull/9867 |
|
895 | # https://github.com/ipython/ipython/pull/9867 | |
894 | if hasattr(self, '_eventloop'): |
|
896 | if hasattr(self, '_eventloop'): | |
895 | self._eventloop.stop() |
|
897 | self._eventloop.stop() | |
896 |
|
898 | |||
897 | self.restore_term_title() |
|
899 | self.restore_term_title() | |
898 |
|
900 | |||
899 | # try to call some at-exit operation optimistically as some things can't |
|
901 | # try to call some at-exit operation optimistically as some things can't | |
900 | # be done during interpreter shutdown. this is technically inaccurate as |
|
902 | # be done during interpreter shutdown. this is technically inaccurate as | |
901 | # this make mainlool not re-callable, but that should be a rare if not |
|
903 | # this make mainlool not re-callable, but that should be a rare if not | |
902 | # in existent use case. |
|
904 | # in existent use case. | |
903 |
|
905 | |||
904 | self._atexit_once() |
|
906 | self._atexit_once() | |
905 |
|
907 | |||
906 |
|
908 | |||
907 | _inputhook = None |
|
909 | _inputhook = None | |
908 | def inputhook(self, context): |
|
910 | def inputhook(self, context): | |
909 | if self._inputhook is not None: |
|
911 | if self._inputhook is not None: | |
910 | self._inputhook(context) |
|
912 | self._inputhook(context) | |
911 |
|
913 | |||
912 | active_eventloop = None |
|
914 | active_eventloop = None | |
913 | def enable_gui(self, gui=None): |
|
915 | def enable_gui(self, gui=None): | |
914 | if self._inputhook is not None and gui is not None: |
|
916 | if self._inputhook is not None and gui is not None: | |
915 | warn( |
|
917 | warn( | |
916 | f"Shell was already running a gui event loop for {self.active_eventloop}; switching to {gui}." |
|
918 | f"Shell was already running a gui event loop for {self.active_eventloop}; switching to {gui}." | |
917 | ) |
|
919 | ) | |
918 | if gui and (gui not in {"inline", "webagg"}): |
|
920 | if gui and (gui not in {"inline", "webagg"}): | |
919 | # This hook runs with each cycle of the `prompt_toolkit`'s event loop. |
|
921 | # This hook runs with each cycle of the `prompt_toolkit`'s event loop. | |
920 | self.active_eventloop, self._inputhook = get_inputhook_name_and_func(gui) |
|
922 | self.active_eventloop, self._inputhook = get_inputhook_name_and_func(gui) | |
921 | else: |
|
923 | else: | |
922 | self.active_eventloop = self._inputhook = None |
|
924 | self.active_eventloop = self._inputhook = None | |
923 |
|
925 | |||
924 | # For prompt_toolkit 3.0. We have to create an asyncio event loop with |
|
926 | # For prompt_toolkit 3.0. We have to create an asyncio event loop with | |
925 | # this inputhook. |
|
927 | # this inputhook. | |
926 | if PTK3: |
|
928 | if PTK3: | |
927 | import asyncio |
|
929 | import asyncio | |
928 | from prompt_toolkit.eventloop import new_eventloop_with_inputhook |
|
930 | from prompt_toolkit.eventloop import new_eventloop_with_inputhook | |
929 |
|
931 | |||
930 | if gui == 'asyncio': |
|
932 | if gui == 'asyncio': | |
931 | # When we integrate the asyncio event loop, run the UI in the |
|
933 | # When we integrate the asyncio event loop, run the UI in the | |
932 | # same event loop as the rest of the code. don't use an actual |
|
934 | # same event loop as the rest of the code. don't use an actual | |
933 | # input hook. (Asyncio is not made for nesting event loops.) |
|
935 | # input hook. (Asyncio is not made for nesting event loops.) | |
934 | self.pt_loop = get_asyncio_loop() |
|
936 | self.pt_loop = get_asyncio_loop() | |
935 |
|
937 | |||
936 | elif self._inputhook: |
|
938 | elif self._inputhook: | |
937 | # If an inputhook was set, create a new asyncio event loop with |
|
939 | # If an inputhook was set, create a new asyncio event loop with | |
938 | # this inputhook for the prompt. |
|
940 | # this inputhook for the prompt. | |
939 | self.pt_loop = new_eventloop_with_inputhook(self._inputhook) |
|
941 | self.pt_loop = new_eventloop_with_inputhook(self._inputhook) | |
940 | else: |
|
942 | else: | |
941 | # When there's no inputhook, run the prompt in a separate |
|
943 | # When there's no inputhook, run the prompt in a separate | |
942 | # asyncio event loop. |
|
944 | # asyncio event loop. | |
943 | self.pt_loop = asyncio.new_event_loop() |
|
945 | self.pt_loop = asyncio.new_event_loop() | |
944 |
|
946 | |||
945 | # Run !system commands directly, not through pipes, so terminal programs |
|
947 | # Run !system commands directly, not through pipes, so terminal programs | |
946 | # work correctly. |
|
948 | # work correctly. | |
947 | system = InteractiveShell.system_raw |
|
949 | system = InteractiveShell.system_raw | |
948 |
|
950 | |||
949 | def auto_rewrite_input(self, cmd): |
|
951 | def auto_rewrite_input(self, cmd): | |
950 | """Overridden from the parent class to use fancy rewriting prompt""" |
|
952 | """Overridden from the parent class to use fancy rewriting prompt""" | |
951 | if not self.show_rewritten_input: |
|
953 | if not self.show_rewritten_input: | |
952 | return |
|
954 | return | |
953 |
|
955 | |||
954 | tokens = self.prompts.rewrite_prompt_tokens() |
|
956 | tokens = self.prompts.rewrite_prompt_tokens() | |
955 | if self.pt_app: |
|
957 | if self.pt_app: | |
956 | print_formatted_text(PygmentsTokens(tokens), end='', |
|
958 | print_formatted_text(PygmentsTokens(tokens), end='', | |
957 | style=self.pt_app.app.style) |
|
959 | style=self.pt_app.app.style) | |
958 | print(cmd) |
|
960 | print(cmd) | |
959 | else: |
|
961 | else: | |
960 | prompt = ''.join(s for t, s in tokens) |
|
962 | prompt = ''.join(s for t, s in tokens) | |
961 | print(prompt, cmd, sep='') |
|
963 | print(prompt, cmd, sep='') | |
962 |
|
964 | |||
963 | _prompts_before = None |
|
965 | _prompts_before = None | |
964 | def switch_doctest_mode(self, mode): |
|
966 | def switch_doctest_mode(self, mode): | |
965 | """Switch prompts to classic for %doctest_mode""" |
|
967 | """Switch prompts to classic for %doctest_mode""" | |
966 | if mode: |
|
968 | if mode: | |
967 | self._prompts_before = self.prompts |
|
969 | self._prompts_before = self.prompts | |
968 | self.prompts = ClassicPrompts(self) |
|
970 | self.prompts = ClassicPrompts(self) | |
969 | elif self._prompts_before: |
|
971 | elif self._prompts_before: | |
970 | self.prompts = self._prompts_before |
|
972 | self.prompts = self._prompts_before | |
971 | self._prompts_before = None |
|
973 | self._prompts_before = None | |
972 | # self._update_layout() |
|
974 | # self._update_layout() | |
973 |
|
975 | |||
974 |
|
976 | |||
975 | InteractiveShellABC.register(TerminalInteractiveShell) |
|
977 | InteractiveShellABC.register(TerminalInteractiveShell) | |
976 |
|
978 | |||
977 | if __name__ == '__main__': |
|
979 | if __name__ == '__main__': | |
978 | TerminalInteractiveShell.instance().interact() |
|
980 | TerminalInteractiveShell.instance().interact() |
@@ -1,1409 +1,1449 | |||||
1 | ============ |
|
1 | ============ | |
2 | 8.x Series |
|
2 | 8.x Series | |
3 | ============ |
|
3 | ============ | |
4 |
|
4 | |||
|
5 | .. _version 8.11.0: | |||
|
6 | ||||
|
7 | IPython 8.11 | |||
|
8 | ------------ | |||
|
9 | ||||
|
10 | Back on almost regular monthly schedule for IPython with end-of-month | |||
|
11 | really-late-Friday release, with a few new features, bugfix and UX improvements. | |||
|
12 | ||||
|
13 | This is a non-exhaustive list, but among other you will find: | |||
|
14 | ||||
|
15 | Faster Traceback Highlighting | |||
|
16 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |||
|
17 | ||||
|
18 | Resurrection of pre-IPython-8 traceback highlighting code. | |||
|
19 | ||||
|
20 | Really long and complicated files were slow to highlight in traceback with | |||
|
21 | IPython 8 despite upstream improvement that make many case better. Therefore | |||
|
22 | starting with IPython 8.11 when one of the highlighted file is more than 10 000 | |||
|
23 | line long by default, we'll fallback to a faster path that does not have all the | |||
|
24 | features of highlighting failing AST nodes. | |||
|
25 | ||||
|
26 | This can be configures by setting the value of | |||
|
27 | ``IPython.code.ultratb.FAST_THRESHOLD`` to an arbitrary low or large value. | |||
|
28 | ||||
|
29 | Miscellaneous | |||
|
30 | ~~~~~~~~~~~~~ | |||
|
31 | ||||
|
32 | - ``%gui`` should now support PySide6. :ghpull:`13864` | |||
|
33 | - Cli shortcuts can now be configured :ghpull:`13928` | |||
|
34 | - Capture output should now respect ``;`` semicolon to suppress output. | |||
|
35 | :ghpull:`13940` | |||
|
36 | ||||
|
37 | - Base64 encoded images (in jupyter frontend), will not have trailing newlines. | |||
|
38 | :ghpull:`13941` | |||
|
39 | ||||
|
40 | As usual you can find the full list of PRs on GitHub under `the 8.10 milestone | |||
|
41 | <https://github.com/ipython/ipython/milestone/113?closed=1>`__. | |||
|
42 | ||||
|
43 | Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring | |||
|
44 | work on IPython and related libraries. | |||
5 |
|
45 | |||
6 | .. _version 8.10.0: |
|
46 | .. _version 8.10.0: | |
7 |
|
47 | |||
8 | IPython 8.10 |
|
48 | IPython 8.10 | |
9 | ------------ |
|
49 | ------------ | |
10 |
|
50 | |||
11 | Out of schedule release of IPython with minor fixes to patch a potential CVE-2023-24816. |
|
51 | Out of schedule release of IPython with minor fixes to patch a potential CVE-2023-24816. | |
12 | This is a really low severity CVE that you most likely are not affected by unless: |
|
52 | This is a really low severity CVE that you most likely are not affected by unless: | |
13 |
|
53 | |||
14 | - You are on windows. |
|
54 | - You are on windows. | |
15 | - You have a custom build of Python without ``_ctypes`` |
|
55 | - You have a custom build of Python without ``_ctypes`` | |
16 | - You cd or start IPython or Jupyter in untrusted directory which names may be |
|
56 | - You cd or start IPython or Jupyter in untrusted directory which names may be | |
17 | valid shell commands. |
|
57 | valid shell commands. | |
18 |
|
58 | |||
19 | You can read more on `the advisory |
|
59 | You can read more on `the advisory | |
20 | <https://github.com/ipython/ipython/security/advisories/GHSA-29gw-9793-fvw7>`__. |
|
60 | <https://github.com/ipython/ipython/security/advisories/GHSA-29gw-9793-fvw7>`__. | |
21 |
|
61 | |||
22 | In addition to fixing this CVE we also fix a couple of outstanding bugs and issues. |
|
62 | In addition to fixing this CVE we also fix a couple of outstanding bugs and issues. | |
23 |
|
63 | |||
24 | As usual you can find the full list of PRs on GitHub under `the 8.10 milestone |
|
64 | As usual you can find the full list of PRs on GitHub under `the 8.10 milestone | |
25 | <https://github.com/ipython/ipython/milestone/112?closed=1>`__. |
|
65 | <https://github.com/ipython/ipython/milestone/112?closed=1>`__. | |
26 |
|
66 | |||
27 | In Particular: |
|
67 | In Particular: | |
28 |
|
68 | |||
29 | - bump minimum numpy to `>=1.21` version following NEP29. :ghpull:`13930` |
|
69 | - bump minimum numpy to `>=1.21` version following NEP29. :ghpull:`13930` | |
30 | - fix for compatibility with MyPy 1.0. :ghpull:`13933` |
|
70 | - fix for compatibility with MyPy 1.0. :ghpull:`13933` | |
31 | - fix nbgrader stalling when IPython's ``showtraceback`` function is |
|
71 | - fix nbgrader stalling when IPython's ``showtraceback`` function is | |
32 | monkeypatched. :ghpull:`13934` |
|
72 | monkeypatched. :ghpull:`13934` | |
33 |
|
73 | |||
34 |
|
74 | |||
35 |
|
75 | |||
36 | As this release also contains those minimal changes in addition to fixing the |
|
76 | As this release also contains those minimal changes in addition to fixing the | |
37 | CVE I decided to bump the minor version anyway. |
|
77 | CVE I decided to bump the minor version anyway. | |
38 |
|
78 | |||
39 | This will not affect the normal release schedule, so IPython 8.11 is due in |
|
79 | This will not affect the normal release schedule, so IPython 8.11 is due in | |
40 | about 2 weeks. |
|
80 | about 2 weeks. | |
41 |
|
81 | |||
42 | .. _version 8.9.0: |
|
82 | .. _version 8.9.0: | |
43 |
|
83 | |||
44 | IPython 8.9.0 |
|
84 | IPython 8.9.0 | |
45 | ------------- |
|
85 | ------------- | |
46 |
|
86 | |||
47 | Second release of IPython in 2023, last Friday of the month, we are back on |
|
87 | Second release of IPython in 2023, last Friday of the month, we are back on | |
48 | track. This is a small release with a few bug-fixes, and improvements, mostly |
|
88 | track. This is a small release with a few bug-fixes, and improvements, mostly | |
49 | with respect to terminal shortcuts. |
|
89 | with respect to terminal shortcuts. | |
50 |
|
90 | |||
51 |
|
91 | |||
52 | The biggest improvement for 8.9 is a drastic amelioration of the |
|
92 | The biggest improvement for 8.9 is a drastic amelioration of the | |
53 | auto-suggestions sponsored by D.E. Shaw and implemented by the more and more |
|
93 | auto-suggestions sponsored by D.E. Shaw and implemented by the more and more | |
54 | active contributor `@krassowski <https://github.com/krassowski>`. |
|
94 | active contributor `@krassowski <https://github.com/krassowski>`. | |
55 |
|
95 | |||
56 | - ``right`` accepts a single character from suggestion |
|
96 | - ``right`` accepts a single character from suggestion | |
57 | - ``ctrl+right`` accepts a semantic token (macos default shortcuts take |
|
97 | - ``ctrl+right`` accepts a semantic token (macos default shortcuts take | |
58 | precedence and need to be disabled to make this work) |
|
98 | precedence and need to be disabled to make this work) | |
59 | - ``backspace`` deletes a character and resumes hinting autosuggestions |
|
99 | - ``backspace`` deletes a character and resumes hinting autosuggestions | |
60 | - ``ctrl-left`` accepts suggestion and moves cursor left one character. |
|
100 | - ``ctrl-left`` accepts suggestion and moves cursor left one character. | |
61 | - ``backspace`` deletes a character and resumes hinting autosuggestions |
|
101 | - ``backspace`` deletes a character and resumes hinting autosuggestions | |
62 | - ``down`` moves to suggestion to later in history when no lines are present below the cursors. |
|
102 | - ``down`` moves to suggestion to later in history when no lines are present below the cursors. | |
63 | - ``up`` moves to suggestion from earlier in history when no lines are present above the cursor. |
|
103 | - ``up`` moves to suggestion from earlier in history when no lines are present above the cursor. | |
64 |
|
104 | |||
65 | This is best described by the Gif posted by `@krassowski |
|
105 | This is best described by the Gif posted by `@krassowski | |
66 | <https://github.com/krassowski>`, and in the PR itself :ghpull:`13888`. |
|
106 | <https://github.com/krassowski>`, and in the PR itself :ghpull:`13888`. | |
67 |
|
107 | |||
68 | .. image:: ../_images/autosuggest.gif |
|
108 | .. image:: ../_images/autosuggest.gif | |
69 |
|
109 | |||
70 | Please report any feedback in order for us to improve the user experience. |
|
110 | Please report any feedback in order for us to improve the user experience. | |
71 | In particular we are also working on making the shortcuts configurable. |
|
111 | In particular we are also working on making the shortcuts configurable. | |
72 |
|
112 | |||
73 | If you are interested in better terminal shortcuts, I also invite you to |
|
113 | If you are interested in better terminal shortcuts, I also invite you to | |
74 | participate in issue `13879 |
|
114 | participate in issue `13879 | |
75 | <https://github.com/ipython/ipython/issues/13879>`__. |
|
115 | <https://github.com/ipython/ipython/issues/13879>`__. | |
76 |
|
116 | |||
77 |
|
117 | |||
78 | As we follow `NEP29 |
|
118 | As we follow `NEP29 | |
79 | <https://numpy.org/neps/nep-0029-deprecation_policy.html>`__, next version of |
|
119 | <https://numpy.org/neps/nep-0029-deprecation_policy.html>`__, next version of | |
80 | IPython will officially stop supporting numpy 1.20, and will stop supporting |
|
120 | IPython will officially stop supporting numpy 1.20, and will stop supporting | |
81 | Python 3.8 after April release. |
|
121 | Python 3.8 after April release. | |
82 |
|
122 | |||
83 | As usual you can find the full list of PRs on GitHub under `the 8.9 milestone |
|
123 | As usual you can find the full list of PRs on GitHub under `the 8.9 milestone | |
84 | <https://github.com/ipython/ipython/milestone/111?closed=1>`__. |
|
124 | <https://github.com/ipython/ipython/milestone/111?closed=1>`__. | |
85 |
|
125 | |||
86 |
|
126 | |||
87 | Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring |
|
127 | Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring | |
88 | work on IPython and related libraries. |
|
128 | work on IPython and related libraries. | |
89 |
|
129 | |||
90 | .. _version 8.8.0: |
|
130 | .. _version 8.8.0: | |
91 |
|
131 | |||
92 | IPython 8.8.0 |
|
132 | IPython 8.8.0 | |
93 | ------------- |
|
133 | ------------- | |
94 |
|
134 | |||
95 | First release of IPython in 2023 as there was no release at the end of |
|
135 | First release of IPython in 2023 as there was no release at the end of | |
96 | December. |
|
136 | December. | |
97 |
|
137 | |||
98 | This is an unusually big release (relatively speaking) with more than 15 Pull |
|
138 | This is an unusually big release (relatively speaking) with more than 15 Pull | |
99 | Requests merged. |
|
139 | Requests merged. | |
100 |
|
140 | |||
101 | Of particular interest are: |
|
141 | Of particular interest are: | |
102 |
|
142 | |||
103 | - :ghpull:`13852` that replaces the greedy completer and improves |
|
143 | - :ghpull:`13852` that replaces the greedy completer and improves | |
104 | completion, in particular for dictionary keys. |
|
144 | completion, in particular for dictionary keys. | |
105 | - :ghpull:`13858` that adds ``py.typed`` to ``setup.cfg`` to make sure it is |
|
145 | - :ghpull:`13858` that adds ``py.typed`` to ``setup.cfg`` to make sure it is | |
106 | bundled in wheels. |
|
146 | bundled in wheels. | |
107 | - :ghpull:`13869` that implements tab completions for IPython options in the |
|
147 | - :ghpull:`13869` that implements tab completions for IPython options in the | |
108 | shell when using `argcomplete <https://github.com/kislyuk/argcomplete>`. I |
|
148 | shell when using `argcomplete <https://github.com/kislyuk/argcomplete>`. I | |
109 | believe this also needs a recent version of Traitlets. |
|
149 | believe this also needs a recent version of Traitlets. | |
110 | - :ghpull:`13865` makes the ``inspector`` class of `InteractiveShell` |
|
150 | - :ghpull:`13865` makes the ``inspector`` class of `InteractiveShell` | |
111 | configurable. |
|
151 | configurable. | |
112 | - :ghpull:`13880` that removes minor-version entrypoints as the minor version |
|
152 | - :ghpull:`13880` that removes minor-version entrypoints as the minor version | |
113 | entry points that would be included in the wheel would be the one of the |
|
153 | entry points that would be included in the wheel would be the one of the | |
114 | Python version that was used to build the ``whl`` file. |
|
154 | Python version that was used to build the ``whl`` file. | |
115 |
|
155 | |||
116 | In no particular order, the rest of the changes update the test suite to be |
|
156 | In no particular order, the rest of the changes update the test suite to be | |
117 | compatible with Pygments 2.14, various docfixes, testing on more recent python |
|
157 | compatible with Pygments 2.14, various docfixes, testing on more recent python | |
118 | versions and various updates. |
|
158 | versions and various updates. | |
119 |
|
159 | |||
120 | As usual you can find the full list of PRs on GitHub under `the 8.8 milestone |
|
160 | As usual you can find the full list of PRs on GitHub under `the 8.8 milestone | |
121 | <https://github.com/ipython/ipython/milestone/110>`__. |
|
161 | <https://github.com/ipython/ipython/milestone/110>`__. | |
122 |
|
162 | |||
123 | Many thanks to @krassowski for the many PRs and @jasongrout for reviewing and |
|
163 | Many thanks to @krassowski for the many PRs and @jasongrout for reviewing and | |
124 | merging contributions. |
|
164 | merging contributions. | |
125 |
|
165 | |||
126 | Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring |
|
166 | Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring | |
127 | work on IPython and related libraries. |
|
167 | work on IPython and related libraries. | |
128 |
|
168 | |||
129 | .. _version 8.7.0: |
|
169 | .. _version 8.7.0: | |
130 |
|
170 | |||
131 | IPython 8.7.0 |
|
171 | IPython 8.7.0 | |
132 | ------------- |
|
172 | ------------- | |
133 |
|
173 | |||
134 |
|
174 | |||
135 | Small release of IPython with a couple of bug fixes and new features for this |
|
175 | Small release of IPython with a couple of bug fixes and new features for this | |
136 | month. Next month is the end of year, it is unclear if there will be a release |
|
176 | month. Next month is the end of year, it is unclear if there will be a release | |
137 | close to the new year's eve, or if the next release will be at the end of January. |
|
177 | close to the new year's eve, or if the next release will be at the end of January. | |
138 |
|
178 | |||
139 | Here are a few of the relevant fixes, |
|
179 | Here are a few of the relevant fixes, | |
140 | as usual you can find the full list of PRs on GitHub under `the 8.7 milestone |
|
180 | as usual you can find the full list of PRs on GitHub under `the 8.7 milestone | |
141 | <https://github.com/ipython/ipython/pulls?q=milestone%3A8.7>`__. |
|
181 | <https://github.com/ipython/ipython/pulls?q=milestone%3A8.7>`__. | |
142 |
|
182 | |||
143 |
|
183 | |||
144 | - :ghpull:`13834` bump the minimum prompt toolkit to 3.0.11. |
|
184 | - :ghpull:`13834` bump the minimum prompt toolkit to 3.0.11. | |
145 | - IPython shipped with the ``py.typed`` marker now, and we are progressively |
|
185 | - IPython shipped with the ``py.typed`` marker now, and we are progressively | |
146 | adding more types. :ghpull:`13831` |
|
186 | adding more types. :ghpull:`13831` | |
147 | - :ghpull:`13817` add configuration of code blacks formatting. |
|
187 | - :ghpull:`13817` add configuration of code blacks formatting. | |
148 |
|
188 | |||
149 |
|
189 | |||
150 | Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring |
|
190 | Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring | |
151 | work on IPython and related libraries. |
|
191 | work on IPython and related libraries. | |
152 |
|
192 | |||
153 |
|
193 | |||
154 | .. _version 8.6.0: |
|
194 | .. _version 8.6.0: | |
155 |
|
195 | |||
156 | IPython 8.6.0 |
|
196 | IPython 8.6.0 | |
157 | ------------- |
|
197 | ------------- | |
158 |
|
198 | |||
159 | Back to a more regular release schedule (at least I try), as Friday is |
|
199 | Back to a more regular release schedule (at least I try), as Friday is | |
160 | already over by more than 24h hours. This is a slightly bigger release with a |
|
200 | already over by more than 24h hours. This is a slightly bigger release with a | |
161 | few new features that contain no less than 25 PRs. |
|
201 | few new features that contain no less than 25 PRs. | |
162 |
|
202 | |||
163 | We'll notably found a couple of non negligible changes: |
|
203 | We'll notably found a couple of non negligible changes: | |
164 |
|
204 | |||
165 | The ``install_ext`` and related functions have been removed after being |
|
205 | The ``install_ext`` and related functions have been removed after being | |
166 | deprecated for years. You can use pip to install extensions. ``pip`` did not |
|
206 | deprecated for years. You can use pip to install extensions. ``pip`` did not | |
167 | exist when ``install_ext`` was introduced. You can still load local extensions |
|
207 | exist when ``install_ext`` was introduced. You can still load local extensions | |
168 | without installing them. Just set your ``sys.path`` for example. :ghpull:`13744` |
|
208 | without installing them. Just set your ``sys.path`` for example. :ghpull:`13744` | |
169 |
|
209 | |||
170 | IPython now has extra entry points that use the major *and minor* version of |
|
210 | IPython now has extra entry points that use the major *and minor* version of | |
171 | python. For some of you this means that you can do a quick ``ipython3.10`` to |
|
211 | python. For some of you this means that you can do a quick ``ipython3.10`` to | |
172 | launch IPython from the Python 3.10 interpreter, while still using Python 3.11 |
|
212 | launch IPython from the Python 3.10 interpreter, while still using Python 3.11 | |
173 | as your main Python. :ghpull:`13743` |
|
213 | as your main Python. :ghpull:`13743` | |
174 |
|
214 | |||
175 | The completer matcher API has been improved. See :ghpull:`13745`. This should |
|
215 | The completer matcher API has been improved. See :ghpull:`13745`. This should | |
176 | improve the type inference and improve dict keys completions in many use case. |
|
216 | improve the type inference and improve dict keys completions in many use case. | |
177 | Thanks ``@krassowski`` for all the work, and the D.E. Shaw group for sponsoring |
|
217 | Thanks ``@krassowski`` for all the work, and the D.E. Shaw group for sponsoring | |
178 | it. |
|
218 | it. | |
179 |
|
219 | |||
180 | The color of error nodes in tracebacks can now be customized. See |
|
220 | The color of error nodes in tracebacks can now be customized. See | |
181 | :ghpull:`13756`. This is a private attribute until someone finds the time to |
|
221 | :ghpull:`13756`. This is a private attribute until someone finds the time to | |
182 | properly add a configuration option. Note that with Python 3.11 that also shows |
|
222 | properly add a configuration option. Note that with Python 3.11 that also shows | |
183 | the relevant nodes in traceback, it would be good to leverage this information |
|
223 | the relevant nodes in traceback, it would be good to leverage this information | |
184 | (plus the "did you mean" info added on attribute errors). But that's likely work |
|
224 | (plus the "did you mean" info added on attribute errors). But that's likely work | |
185 | I won't have time to do before long, so contributions welcome. |
|
225 | I won't have time to do before long, so contributions welcome. | |
186 |
|
226 | |||
187 | As we follow NEP 29, we removed support for numpy 1.19 :ghpull:`13760`. |
|
227 | As we follow NEP 29, we removed support for numpy 1.19 :ghpull:`13760`. | |
188 |
|
228 | |||
189 |
|
229 | |||
190 | The ``open()`` function present in the user namespace by default will now refuse |
|
230 | The ``open()`` function present in the user namespace by default will now refuse | |
191 | to open the file descriptors 0,1,2 (stdin, out, err), to avoid crashing IPython. |
|
231 | to open the file descriptors 0,1,2 (stdin, out, err), to avoid crashing IPython. | |
192 | This mostly occurs in teaching context when incorrect values get passed around. |
|
232 | This mostly occurs in teaching context when incorrect values get passed around. | |
193 |
|
233 | |||
194 |
|
234 | |||
195 | The ``?``, ``??``, and corresponding ``pinfo``, ``pinfo2`` magics can now find |
|
235 | The ``?``, ``??``, and corresponding ``pinfo``, ``pinfo2`` magics can now find | |
196 | objects inside arrays. That is to say, the following now works:: |
|
236 | objects inside arrays. That is to say, the following now works:: | |
197 |
|
237 | |||
198 |
|
238 | |||
199 | >>> def my_func(*arg, **kwargs):pass |
|
239 | >>> def my_func(*arg, **kwargs):pass | |
200 | >>> container = [my_func] |
|
240 | >>> container = [my_func] | |
201 | >>> container[0]? |
|
241 | >>> container[0]? | |
202 |
|
242 | |||
203 |
|
243 | |||
204 | If ``container`` define a custom ``getitem``, this __will__ trigger the custom |
|
244 | If ``container`` define a custom ``getitem``, this __will__ trigger the custom | |
205 | method. So don't put side effects in your ``getitems``. Thanks to the D.E. Shaw |
|
245 | method. So don't put side effects in your ``getitems``. Thanks to the D.E. Shaw | |
206 | group for the request and sponsoring the work. |
|
246 | group for the request and sponsoring the work. | |
207 |
|
247 | |||
208 |
|
248 | |||
209 | As usual you can find the full list of PRs on GitHub under `the 8.6 milestone |
|
249 | As usual you can find the full list of PRs on GitHub under `the 8.6 milestone | |
210 | <https://github.com/ipython/ipython/pulls?q=milestone%3A8.6>`__. |
|
250 | <https://github.com/ipython/ipython/pulls?q=milestone%3A8.6>`__. | |
211 |
|
251 | |||
212 | Thanks to all hacktoberfest contributors, please contribute to |
|
252 | Thanks to all hacktoberfest contributors, please contribute to | |
213 | `closember.org <https://closember.org/>`__. |
|
253 | `closember.org <https://closember.org/>`__. | |
214 |
|
254 | |||
215 | Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring |
|
255 | Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring | |
216 | work on IPython and related libraries. |
|
256 | work on IPython and related libraries. | |
217 |
|
257 | |||
218 | .. _version 8.5.0: |
|
258 | .. _version 8.5.0: | |
219 |
|
259 | |||
220 | IPython 8.5.0 |
|
260 | IPython 8.5.0 | |
221 | ------------- |
|
261 | ------------- | |
222 |
|
262 | |||
223 | First release since a couple of month due to various reasons and timing preventing |
|
263 | First release since a couple of month due to various reasons and timing preventing | |
224 | me for sticking to the usual monthly release the last Friday of each month. This |
|
264 | me for sticking to the usual monthly release the last Friday of each month. This | |
225 | is of non negligible size as it has more than two dozen PRs with various fixes |
|
265 | is of non negligible size as it has more than two dozen PRs with various fixes | |
226 | an bug fixes. |
|
266 | an bug fixes. | |
227 |
|
267 | |||
228 | Many thanks to everybody who contributed PRs for your patience in review and |
|
268 | Many thanks to everybody who contributed PRs for your patience in review and | |
229 | merges. |
|
269 | merges. | |
230 |
|
270 | |||
231 | Here is a non-exhaustive list of changes that have been implemented for IPython |
|
271 | Here is a non-exhaustive list of changes that have been implemented for IPython | |
232 | 8.5.0. As usual you can find the full list of issues and PRs tagged with `the |
|
272 | 8.5.0. As usual you can find the full list of issues and PRs tagged with `the | |
233 | 8.5 milestone |
|
273 | 8.5 milestone | |
234 | <https://github.com/ipython/ipython/pulls?q=is%3Aclosed+milestone%3A8.5+>`__. |
|
274 | <https://github.com/ipython/ipython/pulls?q=is%3Aclosed+milestone%3A8.5+>`__. | |
235 |
|
275 | |||
236 | - Added a shortcut for accepting auto suggestion. The End key shortcut for |
|
276 | - Added a shortcut for accepting auto suggestion. The End key shortcut for | |
237 | accepting auto-suggestion This binding works in Vi mode too, provided |
|
277 | accepting auto-suggestion This binding works in Vi mode too, provided | |
238 | ``TerminalInteractiveShell.emacs_bindings_in_vi_insert_mode`` is set to be |
|
278 | ``TerminalInteractiveShell.emacs_bindings_in_vi_insert_mode`` is set to be | |
239 | ``True`` :ghpull:`13566`. |
|
279 | ``True`` :ghpull:`13566`. | |
240 |
|
280 | |||
241 | - No popup in window for latex generation when generating latex (e.g. via |
|
281 | - No popup in window for latex generation when generating latex (e.g. via | |
242 | `_latex_repr_`) no popup window is shows under Windows. :ghpull:`13679` |
|
282 | `_latex_repr_`) no popup window is shows under Windows. :ghpull:`13679` | |
243 |
|
283 | |||
244 | - Fixed error raised when attempting to tab-complete an input string with |
|
284 | - Fixed error raised when attempting to tab-complete an input string with | |
245 | consecutive periods or forward slashes (such as "file:///var/log/..."). |
|
285 | consecutive periods or forward slashes (such as "file:///var/log/..."). | |
246 | :ghpull:`13675` |
|
286 | :ghpull:`13675` | |
247 |
|
287 | |||
248 | - Relative filenames in Latex rendering : |
|
288 | - Relative filenames in Latex rendering : | |
249 | The `latex_to_png_dvipng` command internally generates input and output file |
|
289 | The `latex_to_png_dvipng` command internally generates input and output file | |
250 | arguments to `latex` and `dvipis`. These arguments are now generated as |
|
290 | arguments to `latex` and `dvipis`. These arguments are now generated as | |
251 | relative files to the current working directory instead of absolute file |
|
291 | relative files to the current working directory instead of absolute file | |
252 | paths. This solves a problem where the current working directory contains |
|
292 | paths. This solves a problem where the current working directory contains | |
253 | characters that are not handled properly by `latex` and `dvips`. There are |
|
293 | characters that are not handled properly by `latex` and `dvips`. There are | |
254 | no changes to the user API. :ghpull:`13680` |
|
294 | no changes to the user API. :ghpull:`13680` | |
255 |
|
295 | |||
256 | - Stripping decorators bug: Fixed bug which meant that ipython code blocks in |
|
296 | - Stripping decorators bug: Fixed bug which meant that ipython code blocks in | |
257 | restructured text documents executed with the ipython-sphinx extension |
|
297 | restructured text documents executed with the ipython-sphinx extension | |
258 | skipped any lines of code containing python decorators. :ghpull:`13612` |
|
298 | skipped any lines of code containing python decorators. :ghpull:`13612` | |
259 |
|
299 | |||
260 | - Allow some modules with frozen dataclasses to be reloaded. :ghpull:`13732` |
|
300 | - Allow some modules with frozen dataclasses to be reloaded. :ghpull:`13732` | |
261 | - Fix paste magic on wayland. :ghpull:`13671` |
|
301 | - Fix paste magic on wayland. :ghpull:`13671` | |
262 | - show maxlen in deque's repr. :ghpull:`13648` |
|
302 | - show maxlen in deque's repr. :ghpull:`13648` | |
263 |
|
303 | |||
264 | Restore line numbers for Input |
|
304 | Restore line numbers for Input | |
265 | ------------------------------ |
|
305 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
266 |
|
306 | |||
267 | Line number information in tracebacks from input are restored. |
|
307 | Line number information in tracebacks from input are restored. | |
268 | Line numbers from input were removed during the transition to v8 enhanced traceback reporting. |
|
308 | Line numbers from input were removed during the transition to v8 enhanced traceback reporting. | |
269 |
|
309 | |||
270 | So, instead of:: |
|
310 | So, instead of:: | |
271 |
|
311 | |||
272 | --------------------------------------------------------------------------- |
|
312 | --------------------------------------------------------------------------- | |
273 | ZeroDivisionError Traceback (most recent call last) |
|
313 | ZeroDivisionError Traceback (most recent call last) | |
274 | Input In [3], in <cell line: 1>() |
|
314 | Input In [3], in <cell line: 1>() | |
275 | ----> 1 myfunc(2) |
|
315 | ----> 1 myfunc(2) | |
276 |
|
316 | |||
277 | Input In [2], in myfunc(z) |
|
317 | Input In [2], in myfunc(z) | |
278 | 1 def myfunc(z): |
|
318 | 1 def myfunc(z): | |
279 | ----> 2 foo.boo(z-1) |
|
319 | ----> 2 foo.boo(z-1) | |
280 |
|
320 | |||
281 | File ~/code/python/ipython/foo.py:3, in boo(x) |
|
321 | File ~/code/python/ipython/foo.py:3, in boo(x) | |
282 | 2 def boo(x): |
|
322 | 2 def boo(x): | |
283 | ----> 3 return 1/(1-x) |
|
323 | ----> 3 return 1/(1-x) | |
284 |
|
324 | |||
285 | ZeroDivisionError: division by zero |
|
325 | ZeroDivisionError: division by zero | |
286 |
|
326 | |||
287 | The error traceback now looks like:: |
|
327 | The error traceback now looks like:: | |
288 |
|
328 | |||
289 | --------------------------------------------------------------------------- |
|
329 | --------------------------------------------------------------------------- | |
290 | ZeroDivisionError Traceback (most recent call last) |
|
330 | ZeroDivisionError Traceback (most recent call last) | |
291 | Cell In [3], line 1 |
|
331 | Cell In [3], line 1 | |
292 | ----> 1 myfunc(2) |
|
332 | ----> 1 myfunc(2) | |
293 |
|
333 | |||
294 | Cell In [2], line 2, in myfunc(z) |
|
334 | Cell In [2], line 2, in myfunc(z) | |
295 | 1 def myfunc(z): |
|
335 | 1 def myfunc(z): | |
296 | ----> 2 foo.boo(z-1) |
|
336 | ----> 2 foo.boo(z-1) | |
297 |
|
337 | |||
298 | File ~/code/python/ipython/foo.py:3, in boo(x) |
|
338 | File ~/code/python/ipython/foo.py:3, in boo(x) | |
299 | 2 def boo(x): |
|
339 | 2 def boo(x): | |
300 | ----> 3 return 1/(1-x) |
|
340 | ----> 3 return 1/(1-x) | |
301 |
|
341 | |||
302 | ZeroDivisionError: division by zero |
|
342 | ZeroDivisionError: division by zero | |
303 |
|
343 | |||
304 | or, with xmode=Plain:: |
|
344 | or, with xmode=Plain:: | |
305 |
|
345 | |||
306 | Traceback (most recent call last): |
|
346 | Traceback (most recent call last): | |
307 | Cell In [12], line 1 |
|
347 | Cell In [12], line 1 | |
308 | myfunc(2) |
|
348 | myfunc(2) | |
309 | Cell In [6], line 2 in myfunc |
|
349 | Cell In [6], line 2 in myfunc | |
310 | foo.boo(z-1) |
|
350 | foo.boo(z-1) | |
311 | File ~/code/python/ipython/foo.py:3 in boo |
|
351 | File ~/code/python/ipython/foo.py:3 in boo | |
312 | return 1/(1-x) |
|
352 | return 1/(1-x) | |
313 | ZeroDivisionError: division by zero |
|
353 | ZeroDivisionError: division by zero | |
314 |
|
354 | |||
315 | :ghpull:`13560` |
|
355 | :ghpull:`13560` | |
316 |
|
356 | |||
317 | New setting to silence warning if working inside a virtual environment |
|
357 | New setting to silence warning if working inside a virtual environment | |
318 | ---------------------------------------------------------------------- |
|
358 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
319 |
|
359 | |||
320 | Previously, when starting IPython in a virtual environment without IPython installed (so IPython from the global environment is used), the following warning was printed: |
|
360 | Previously, when starting IPython in a virtual environment without IPython installed (so IPython from the global environment is used), the following warning was printed: | |
321 |
|
361 | |||
322 | Attempting to work in a virtualenv. If you encounter problems, please install IPython inside the virtualenv. |
|
362 | Attempting to work in a virtualenv. If you encounter problems, please install IPython inside the virtualenv. | |
323 |
|
363 | |||
324 | This warning can be permanently silenced by setting ``c.InteractiveShell.warn_venv`` to ``False`` (the default is ``True``). |
|
364 | This warning can be permanently silenced by setting ``c.InteractiveShell.warn_venv`` to ``False`` (the default is ``True``). | |
325 |
|
365 | |||
326 | :ghpull:`13706` |
|
366 | :ghpull:`13706` | |
327 |
|
367 | |||
328 | ------- |
|
368 | ------- | |
329 |
|
369 | |||
330 | Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring |
|
370 | Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring | |
331 | work on IPython and related libraries. |
|
371 | work on IPython and related libraries. | |
332 |
|
372 | |||
333 |
|
373 | |||
334 | .. _version 8.4.0: |
|
374 | .. _version 8.4.0: | |
335 |
|
375 | |||
336 | IPython 8.4.0 |
|
376 | IPython 8.4.0 | |
337 | ------------- |
|
377 | ------------- | |
338 |
|
378 | |||
339 | As for 7.34, this version contains a single fix: fix uncaught BdbQuit exceptions on ipdb |
|
379 | As for 7.34, this version contains a single fix: fix uncaught BdbQuit exceptions on ipdb | |
340 | exit :ghpull:`13668`, and a single typo fix in documentation: :ghpull:`13682` |
|
380 | exit :ghpull:`13668`, and a single typo fix in documentation: :ghpull:`13682` | |
341 |
|
381 | |||
342 | Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring |
|
382 | Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring | |
343 | work on IPython and related libraries. |
|
383 | work on IPython and related libraries. | |
344 |
|
384 | |||
345 |
|
385 | |||
346 | .. _version 8.3.0: |
|
386 | .. _version 8.3.0: | |
347 |
|
387 | |||
348 | IPython 8.3.0 |
|
388 | IPython 8.3.0 | |
349 | ------------- |
|
389 | ------------- | |
350 |
|
390 | |||
351 | - :ghpull:`13625`, using ``?``, ``??``, ``*?`` will not call |
|
391 | - :ghpull:`13625`, using ``?``, ``??``, ``*?`` will not call | |
352 | ``set_next_input`` as most frontend allow proper multiline editing and it was |
|
392 | ``set_next_input`` as most frontend allow proper multiline editing and it was | |
353 | causing issues for many users of multi-cell frontends. This has been backported to 7.33 |
|
393 | causing issues for many users of multi-cell frontends. This has been backported to 7.33 | |
354 |
|
394 | |||
355 |
|
395 | |||
356 | - :ghpull:`13600`, ``pre_run_*``-hooks will now have a ``cell_id`` attribute on |
|
396 | - :ghpull:`13600`, ``pre_run_*``-hooks will now have a ``cell_id`` attribute on | |
357 | the info object when frontend provides it. This has been backported to 7.33 |
|
397 | the info object when frontend provides it. This has been backported to 7.33 | |
358 |
|
398 | |||
359 | - :ghpull:`13624`, fixed :kbd:`End` key being broken after accepting an |
|
399 | - :ghpull:`13624`, fixed :kbd:`End` key being broken after accepting an | |
360 | auto-suggestion. |
|
400 | auto-suggestion. | |
361 |
|
401 | |||
362 | - :ghpull:`13657` fixed an issue where history from different sessions would be mixed. |
|
402 | - :ghpull:`13657` fixed an issue where history from different sessions would be mixed. | |
363 |
|
403 | |||
364 | .. _version 8.2.0: |
|
404 | .. _version 8.2.0: | |
365 |
|
405 | |||
366 | IPython 8.2.0 |
|
406 | IPython 8.2.0 | |
367 | ------------- |
|
407 | ------------- | |
368 |
|
408 | |||
369 | IPython 8.2 mostly bring bugfixes to IPython. |
|
409 | IPython 8.2 mostly bring bugfixes to IPython. | |
370 |
|
410 | |||
371 | - Auto-suggestion can now be elected with the ``end`` key. :ghpull:`13566` |
|
411 | - Auto-suggestion can now be elected with the ``end`` key. :ghpull:`13566` | |
372 | - Some traceback issues with ``assert etb is not None`` have been fixed. :ghpull:`13588` |
|
412 | - Some traceback issues with ``assert etb is not None`` have been fixed. :ghpull:`13588` | |
373 | - History is now pulled from the sqitel database and not from in-memory. |
|
413 | - History is now pulled from the sqitel database and not from in-memory. | |
374 | In particular when using the ``%paste`` magic, the content of the pasted text will |
|
414 | In particular when using the ``%paste`` magic, the content of the pasted text will | |
375 | be part of the history and not the verbatim text ``%paste`` anymore. :ghpull:`13592` |
|
415 | be part of the history and not the verbatim text ``%paste`` anymore. :ghpull:`13592` | |
376 | - Fix ``Ctrl-\\`` exit cleanup :ghpull:`13603` |
|
416 | - Fix ``Ctrl-\\`` exit cleanup :ghpull:`13603` | |
377 | - Fixes to ``ultratb`` ipdb support when used outside of IPython. :ghpull:`13498` |
|
417 | - Fixes to ``ultratb`` ipdb support when used outside of IPython. :ghpull:`13498` | |
378 |
|
418 | |||
379 |
|
419 | |||
380 | I am still trying to fix and investigate :ghissue:`13598`, which seems to be |
|
420 | I am still trying to fix and investigate :ghissue:`13598`, which seems to be | |
381 | random, and would appreciate help if you find a reproducible minimal case. I've |
|
421 | random, and would appreciate help if you find a reproducible minimal case. I've | |
382 | tried to make various changes to the codebase to mitigate it, but a proper fix |
|
422 | tried to make various changes to the codebase to mitigate it, but a proper fix | |
383 | will be difficult without understanding the cause. |
|
423 | will be difficult without understanding the cause. | |
384 |
|
424 | |||
385 |
|
425 | |||
386 | All the issues on pull-requests for this release can be found in the `8.2 |
|
426 | All the issues on pull-requests for this release can be found in the `8.2 | |
387 | milestone. <https://github.com/ipython/ipython/milestone/100>`__ . And some |
|
427 | milestone. <https://github.com/ipython/ipython/milestone/100>`__ . And some | |
388 | documentation only PR can be found as part of the `7.33 milestone |
|
428 | documentation only PR can be found as part of the `7.33 milestone | |
389 | <https://github.com/ipython/ipython/milestone/101>`__ (currently not released). |
|
429 | <https://github.com/ipython/ipython/milestone/101>`__ (currently not released). | |
390 |
|
430 | |||
391 | Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring |
|
431 | Thanks to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring | |
392 | work on IPython and related libraries. |
|
432 | work on IPython and related libraries. | |
393 |
|
433 | |||
394 | .. _version 8.1.1: |
|
434 | .. _version 8.1.1: | |
395 |
|
435 | |||
396 | IPython 8.1.1 |
|
436 | IPython 8.1.1 | |
397 | ------------- |
|
437 | ------------- | |
398 |
|
438 | |||
399 | Fix an issue with virtualenv and Python 3.8 introduced in 8.1 |
|
439 | Fix an issue with virtualenv and Python 3.8 introduced in 8.1 | |
400 |
|
440 | |||
401 | Revert :ghpull:`13537` (fix an issue with symlinks in virtualenv) that raises an |
|
441 | Revert :ghpull:`13537` (fix an issue with symlinks in virtualenv) that raises an | |
402 | error in Python 3.8, and fixed in a different way in :ghpull:`13559`. |
|
442 | error in Python 3.8, and fixed in a different way in :ghpull:`13559`. | |
403 |
|
443 | |||
404 | .. _version 8.1: |
|
444 | .. _version 8.1: | |
405 |
|
445 | |||
406 | IPython 8.1.0 |
|
446 | IPython 8.1.0 | |
407 | ------------- |
|
447 | ------------- | |
408 |
|
448 | |||
409 | IPython 8.1 is the first minor release after 8.0 and fixes a number of bugs and |
|
449 | IPython 8.1 is the first minor release after 8.0 and fixes a number of bugs and | |
410 | updates a few behaviors that were problematic with the 8.0 as with many new major |
|
450 | updates a few behaviors that were problematic with the 8.0 as with many new major | |
411 | release. |
|
451 | release. | |
412 |
|
452 | |||
413 | Note that beyond the changes listed here, IPython 8.1.0 also contains all the |
|
453 | Note that beyond the changes listed here, IPython 8.1.0 also contains all the | |
414 | features listed in :ref:`version 7.32`. |
|
454 | features listed in :ref:`version 7.32`. | |
415 |
|
455 | |||
416 | - Misc and multiple fixes around quotation auto-closing. It is now disabled by |
|
456 | - Misc and multiple fixes around quotation auto-closing. It is now disabled by | |
417 | default. Run with ``TerminalInteractiveShell.auto_match=True`` to re-enabled |
|
457 | default. Run with ``TerminalInteractiveShell.auto_match=True`` to re-enabled | |
418 | - Require pygments>=2.4.0 :ghpull:`13459`, this was implicit in the code, but |
|
458 | - Require pygments>=2.4.0 :ghpull:`13459`, this was implicit in the code, but | |
419 | is now explicit in ``setup.cfg``/``setup.py`` |
|
459 | is now explicit in ``setup.cfg``/``setup.py`` | |
420 | - Docs improvement of ``core.magic_arguments`` examples. :ghpull:`13433` |
|
460 | - Docs improvement of ``core.magic_arguments`` examples. :ghpull:`13433` | |
421 | - Multi-line edit executes too early with await. :ghpull:`13424` |
|
461 | - Multi-line edit executes too early with await. :ghpull:`13424` | |
422 |
|
462 | |||
423 | - ``black`` is back as an optional dependency, and autoformatting disabled by |
|
463 | - ``black`` is back as an optional dependency, and autoformatting disabled by | |
424 | default until some fixes are implemented (black improperly reformat magics). |
|
464 | default until some fixes are implemented (black improperly reformat magics). | |
425 | :ghpull:`13471` Additionally the ability to use ``yapf`` as a code |
|
465 | :ghpull:`13471` Additionally the ability to use ``yapf`` as a code | |
426 | reformatter has been added :ghpull:`13528` . You can use |
|
466 | reformatter has been added :ghpull:`13528` . You can use | |
427 | ``TerminalInteractiveShell.autoformatter="black"``, |
|
467 | ``TerminalInteractiveShell.autoformatter="black"``, | |
428 | ``TerminalInteractiveShell.autoformatter="yapf"`` to re-enable auto formating |
|
468 | ``TerminalInteractiveShell.autoformatter="yapf"`` to re-enable auto formating | |
429 | with black, or switch to yapf. |
|
469 | with black, or switch to yapf. | |
430 |
|
470 | |||
431 | - Fix and issue where ``display`` was not defined. |
|
471 | - Fix and issue where ``display`` was not defined. | |
432 |
|
472 | |||
433 | - Auto suggestions are now configurable. Currently only |
|
473 | - Auto suggestions are now configurable. Currently only | |
434 | ``AutoSuggestFromHistory`` (default) and ``None``. new provider contribution |
|
474 | ``AutoSuggestFromHistory`` (default) and ``None``. new provider contribution | |
435 | welcomed. :ghpull:`13475` |
|
475 | welcomed. :ghpull:`13475` | |
436 |
|
476 | |||
437 | - multiple packaging/testing improvement to simplify downstream packaging |
|
477 | - multiple packaging/testing improvement to simplify downstream packaging | |
438 | (xfail with reasons, try to not access network...). |
|
478 | (xfail with reasons, try to not access network...). | |
439 |
|
479 | |||
440 | - Update deprecation. ``InteractiveShell.magic`` internal method has been |
|
480 | - Update deprecation. ``InteractiveShell.magic`` internal method has been | |
441 | deprecated for many years but did not emit a warning until now. |
|
481 | deprecated for many years but did not emit a warning until now. | |
442 |
|
482 | |||
443 | - internal ``appended_to_syspath`` context manager has been deprecated. |
|
483 | - internal ``appended_to_syspath`` context manager has been deprecated. | |
444 |
|
484 | |||
445 | - fix an issue with symlinks in virtualenv :ghpull:`13537` (Reverted in 8.1.1) |
|
485 | - fix an issue with symlinks in virtualenv :ghpull:`13537` (Reverted in 8.1.1) | |
446 |
|
486 | |||
447 | - Fix an issue with vim mode, where cursor would not be reset on exit :ghpull:`13472` |
|
487 | - Fix an issue with vim mode, where cursor would not be reset on exit :ghpull:`13472` | |
448 |
|
488 | |||
449 | - ipython directive now remove only known pseudo-decorators :ghpull:`13532` |
|
489 | - ipython directive now remove only known pseudo-decorators :ghpull:`13532` | |
450 |
|
490 | |||
451 | - ``IPython/lib/security`` which used to be used for jupyter notebook has been |
|
491 | - ``IPython/lib/security`` which used to be used for jupyter notebook has been | |
452 | removed. |
|
492 | removed. | |
453 |
|
493 | |||
454 | - Fix an issue where ``async with`` would execute on new lines. :ghpull:`13436` |
|
494 | - Fix an issue where ``async with`` would execute on new lines. :ghpull:`13436` | |
455 |
|
495 | |||
456 |
|
496 | |||
457 | We want to remind users that IPython is part of the Jupyter organisations, and |
|
497 | We want to remind users that IPython is part of the Jupyter organisations, and | |
458 | thus governed by a Code of Conduct. Some of the behavior we have seen on GitHub is not acceptable. |
|
498 | thus governed by a Code of Conduct. Some of the behavior we have seen on GitHub is not acceptable. | |
459 | Abuse and non-respectful comments on discussion will not be tolerated. |
|
499 | Abuse and non-respectful comments on discussion will not be tolerated. | |
460 |
|
500 | |||
461 | Many thanks to all the contributors to this release, many of the above fixed issues and |
|
501 | Many thanks to all the contributors to this release, many of the above fixed issues and | |
462 | new features were done by first time contributors, showing there is still |
|
502 | new features were done by first time contributors, showing there is still | |
463 | plenty of easy contribution possible in IPython |
|
503 | plenty of easy contribution possible in IPython | |
464 | . You can find all individual contributions |
|
504 | . You can find all individual contributions | |
465 | to this milestone `on github <https://github.com/ipython/ipython/milestone/91>`__. |
|
505 | to this milestone `on github <https://github.com/ipython/ipython/milestone/91>`__. | |
466 |
|
506 | |||
467 | Thanks as well to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring |
|
507 | Thanks as well to the `D. E. Shaw group <https://deshaw.com/>`__ for sponsoring | |
468 | work on IPython and related libraries. In particular the Lazy autoloading of |
|
508 | work on IPython and related libraries. In particular the Lazy autoloading of | |
469 | magics that you will find described in the 7.32 release notes. |
|
509 | magics that you will find described in the 7.32 release notes. | |
470 |
|
510 | |||
471 |
|
511 | |||
472 | .. _version 8.0.1: |
|
512 | .. _version 8.0.1: | |
473 |
|
513 | |||
474 | IPython 8.0.1 (CVE-2022-21699) |
|
514 | IPython 8.0.1 (CVE-2022-21699) | |
475 | ------------------------------ |
|
515 | ------------------------------ | |
476 |
|
516 | |||
477 | IPython 8.0.1, 7.31.1 and 5.11 are security releases that change some default |
|
517 | IPython 8.0.1, 7.31.1 and 5.11 are security releases that change some default | |
478 | values in order to prevent potential Execution with Unnecessary Privileges. |
|
518 | values in order to prevent potential Execution with Unnecessary Privileges. | |
479 |
|
519 | |||
480 | Almost all version of IPython looks for configuration and profiles in current |
|
520 | Almost all version of IPython looks for configuration and profiles in current | |
481 | working directory. Since IPython was developed before pip and environments |
|
521 | working directory. Since IPython was developed before pip and environments | |
482 | existed it was used a convenient way to load code/packages in a project |
|
522 | existed it was used a convenient way to load code/packages in a project | |
483 | dependant way. |
|
523 | dependant way. | |
484 |
|
524 | |||
485 | In 2022, it is not necessary anymore, and can lead to confusing behavior where |
|
525 | In 2022, it is not necessary anymore, and can lead to confusing behavior where | |
486 | for example cloning a repository and starting IPython or loading a notebook from |
|
526 | for example cloning a repository and starting IPython or loading a notebook from | |
487 | any Jupyter-Compatible interface that has ipython set as a kernel can lead to |
|
527 | any Jupyter-Compatible interface that has ipython set as a kernel can lead to | |
488 | code execution. |
|
528 | code execution. | |
489 |
|
529 | |||
490 |
|
530 | |||
491 | I did not find any standard way for packaged to advertise CVEs they fix, I'm |
|
531 | I did not find any standard way for packaged to advertise CVEs they fix, I'm | |
492 | thus trying to add a ``__patched_cves__`` attribute to the IPython module that |
|
532 | thus trying to add a ``__patched_cves__`` attribute to the IPython module that | |
493 | list the CVEs that should have been fixed. This attribute is informational only |
|
533 | list the CVEs that should have been fixed. This attribute is informational only | |
494 | as if a executable has a flaw, this value can always be changed by an attacker. |
|
534 | as if a executable has a flaw, this value can always be changed by an attacker. | |
495 |
|
535 | |||
496 | .. code:: |
|
536 | .. code:: | |
497 |
|
537 | |||
498 | In [1]: import IPython |
|
538 | In [1]: import IPython | |
499 |
|
539 | |||
500 | In [2]: IPython.__patched_cves__ |
|
540 | In [2]: IPython.__patched_cves__ | |
501 | Out[2]: {'CVE-2022-21699'} |
|
541 | Out[2]: {'CVE-2022-21699'} | |
502 |
|
542 | |||
503 | In [3]: 'CVE-2022-21699' in IPython.__patched_cves__ |
|
543 | In [3]: 'CVE-2022-21699' in IPython.__patched_cves__ | |
504 | Out[3]: True |
|
544 | Out[3]: True | |
505 |
|
545 | |||
506 | Thus starting with this version: |
|
546 | Thus starting with this version: | |
507 |
|
547 | |||
508 | - The current working directory is not searched anymore for profiles or |
|
548 | - The current working directory is not searched anymore for profiles or | |
509 | configurations files. |
|
549 | configurations files. | |
510 | - Added a ``__patched_cves__`` attribute (set of strings) to IPython module that contain |
|
550 | - Added a ``__patched_cves__`` attribute (set of strings) to IPython module that contain | |
511 | the list of fixed CVE. This is informational only. |
|
551 | the list of fixed CVE. This is informational only. | |
512 |
|
552 | |||
513 | Further details can be read on the `GitHub Advisory <https://github.com/ipython/ipython/security/advisories/GHSA-pq7m-3gw7-gq5x>`__ |
|
553 | Further details can be read on the `GitHub Advisory <https://github.com/ipython/ipython/security/advisories/GHSA-pq7m-3gw7-gq5x>`__ | |
514 |
|
554 | |||
515 |
|
555 | |||
516 | .. _version 8.0: |
|
556 | .. _version 8.0: | |
517 |
|
557 | |||
518 | IPython 8.0 |
|
558 | IPython 8.0 | |
519 | ----------- |
|
559 | ----------- | |
520 |
|
560 | |||
521 | IPython 8.0 is bringing a large number of new features and improvements to both the |
|
561 | IPython 8.0 is bringing a large number of new features and improvements to both the | |
522 | user of the terminal and of the kernel via Jupyter. The removal of compatibility |
|
562 | user of the terminal and of the kernel via Jupyter. The removal of compatibility | |
523 | with an older version of Python is also the opportunity to do a couple of |
|
563 | with an older version of Python is also the opportunity to do a couple of | |
524 | performance improvements in particular with respect to startup time. |
|
564 | performance improvements in particular with respect to startup time. | |
525 | The 8.x branch started diverging from its predecessor around IPython 7.12 |
|
565 | The 8.x branch started diverging from its predecessor around IPython 7.12 | |
526 | (January 2020). |
|
566 | (January 2020). | |
527 |
|
567 | |||
528 | This release contains 250+ pull requests, in addition to many of the features |
|
568 | This release contains 250+ pull requests, in addition to many of the features | |
529 | and backports that have made it to the 7.x branch. Please see the |
|
569 | and backports that have made it to the 7.x branch. Please see the | |
530 | `8.0 milestone <https://github.com/ipython/ipython/milestone/73?closed=1>`__ for the full list of pull requests. |
|
570 | `8.0 milestone <https://github.com/ipython/ipython/milestone/73?closed=1>`__ for the full list of pull requests. | |
531 |
|
571 | |||
532 | Please feel free to send pull requests to update those notes after release, |
|
572 | Please feel free to send pull requests to update those notes after release, | |
533 | I have likely forgotten a few things reviewing 250+ PRs. |
|
573 | I have likely forgotten a few things reviewing 250+ PRs. | |
534 |
|
574 | |||
535 | Dependencies changes/downstream packaging |
|
575 | Dependencies changes/downstream packaging | |
536 | ----------------------------------------- |
|
576 | ----------------------------------------- | |
537 |
|
577 | |||
538 | Most of our building steps have been changed to be (mostly) declarative |
|
578 | Most of our building steps have been changed to be (mostly) declarative | |
539 | and follow PEP 517. We are trying to completely remove ``setup.py`` (:ghpull:`13238`) and are |
|
579 | and follow PEP 517. We are trying to completely remove ``setup.py`` (:ghpull:`13238`) and are | |
540 | looking for help to do so. |
|
580 | looking for help to do so. | |
541 |
|
581 | |||
542 | - minimum supported ``traitlets`` version is now 5+ |
|
582 | - minimum supported ``traitlets`` version is now 5+ | |
543 | - we now require ``stack_data`` |
|
583 | - we now require ``stack_data`` | |
544 | - minimal Python is now 3.8 |
|
584 | - minimal Python is now 3.8 | |
545 | - ``nose`` is not a testing requirement anymore |
|
585 | - ``nose`` is not a testing requirement anymore | |
546 | - ``pytest`` replaces nose. |
|
586 | - ``pytest`` replaces nose. | |
547 | - ``iptest``/``iptest3`` cli entrypoints do not exist anymore. |
|
587 | - ``iptest``/``iptest3`` cli entrypoints do not exist anymore. | |
548 | - the minimum officially βsupported ``numpy`` version has been bumped, but this should |
|
588 | - the minimum officially βsupported ``numpy`` version has been bumped, but this should | |
549 | not have much effect on packaging. |
|
589 | not have much effect on packaging. | |
550 |
|
590 | |||
551 |
|
591 | |||
552 | Deprecation and removal |
|
592 | Deprecation and removal | |
553 | ----------------------- |
|
593 | ----------------------- | |
554 |
|
594 | |||
555 | We removed almost all features, arguments, functions, and modules that were |
|
595 | We removed almost all features, arguments, functions, and modules that were | |
556 | marked as deprecated between IPython 1.0 and 5.0. As a reminder, 5.0 was released |
|
596 | marked as deprecated between IPython 1.0 and 5.0. As a reminder, 5.0 was released | |
557 | in 2016, and 1.0 in 2013. Last release of the 5 branch was 5.10.0, in May 2020. |
|
597 | in 2016, and 1.0 in 2013. Last release of the 5 branch was 5.10.0, in May 2020. | |
558 | The few remaining deprecated features we left have better deprecation warnings |
|
598 | The few remaining deprecated features we left have better deprecation warnings | |
559 | or have been turned into explicit errors for better error messages. |
|
599 | or have been turned into explicit errors for better error messages. | |
560 |
|
600 | |||
561 | I will use this occasion to add the following requests to anyone emitting a |
|
601 | I will use this occasion to add the following requests to anyone emitting a | |
562 | deprecation warning: |
|
602 | deprecation warning: | |
563 |
|
603 | |||
564 | - Please add at least ``stacklevel=2`` so that the warning is emitted into the |
|
604 | - Please add at least ``stacklevel=2`` so that the warning is emitted into the | |
565 | caller context, and not the callee one. |
|
605 | caller context, and not the callee one. | |
566 | - Please add **since which version** something is deprecated. |
|
606 | - Please add **since which version** something is deprecated. | |
567 |
|
607 | |||
568 | As a side note, it is much easier to conditionally compare version |
|
608 | As a side note, it is much easier to conditionally compare version | |
569 | numbers rather than using ``try/except`` when functionality changes with a version. |
|
609 | numbers rather than using ``try/except`` when functionality changes with a version. | |
570 |
|
610 | |||
571 | I won't list all the removed features here, but modules like ``IPython.kernel``, |
|
611 | I won't list all the removed features here, but modules like ``IPython.kernel``, | |
572 | which was just a shim module around ``ipykernel`` for the past 8 years, have been |
|
612 | which was just a shim module around ``ipykernel`` for the past 8 years, have been | |
573 | removed, and so many other similar things that pre-date the name **Jupyter** |
|
613 | removed, and so many other similar things that pre-date the name **Jupyter** | |
574 | itself. |
|
614 | itself. | |
575 |
|
615 | |||
576 | We no longer need to add ``IPython.extensions`` to the PYTHONPATH because that is being |
|
616 | We no longer need to add ``IPython.extensions`` to the PYTHONPATH because that is being | |
577 | handled by ``load_extension``. |
|
617 | handled by ``load_extension``. | |
578 |
|
618 | |||
579 | We are also removing ``Cythonmagic``, ``sympyprinting`` and ``rmagic`` as they are now in |
|
619 | We are also removing ``Cythonmagic``, ``sympyprinting`` and ``rmagic`` as they are now in | |
580 | other packages and no longer need to be inside IPython. |
|
620 | other packages and no longer need to be inside IPython. | |
581 |
|
621 | |||
582 |
|
622 | |||
583 | Documentation |
|
623 | Documentation | |
584 | ------------- |
|
624 | ------------- | |
585 |
|
625 | |||
586 | The majority of our docstrings have now been reformatted and automatically fixed by |
|
626 | The majority of our docstrings have now been reformatted and automatically fixed by | |
587 | the experimental `VΓ©lin <https://pypi.org/project/velin/>`_ project to conform |
|
627 | the experimental `VΓ©lin <https://pypi.org/project/velin/>`_ project to conform | |
588 | to numpydoc. |
|
628 | to numpydoc. | |
589 |
|
629 | |||
590 | Type annotations |
|
630 | Type annotations | |
591 | ---------------- |
|
631 | ---------------- | |
592 |
|
632 | |||
593 | While IPython itself is highly dynamic and can't be completely typed, many of |
|
633 | While IPython itself is highly dynamic and can't be completely typed, many of | |
594 | the functions now have type annotations, and part of the codebase is now checked |
|
634 | the functions now have type annotations, and part of the codebase is now checked | |
595 | by mypy. |
|
635 | by mypy. | |
596 |
|
636 | |||
597 |
|
637 | |||
598 | Featured changes |
|
638 | Featured changes | |
599 | ---------------- |
|
639 | ---------------- | |
600 |
|
640 | |||
601 | Here is a features list of changes in IPython 8.0. This is of course non-exhaustive. |
|
641 | Here is a features list of changes in IPython 8.0. This is of course non-exhaustive. | |
602 | Please note as well that many features have been added in the 7.x branch as well |
|
642 | Please note as well that many features have been added in the 7.x branch as well | |
603 | (and hence why you want to read the 7.x what's new notes), in particular |
|
643 | (and hence why you want to read the 7.x what's new notes), in particular | |
604 | features contributed by QuantStack (with respect to debugger protocol and Xeus |
|
644 | features contributed by QuantStack (with respect to debugger protocol and Xeus | |
605 | Python), as well as many debugger features that I was pleased to implement as |
|
645 | Python), as well as many debugger features that I was pleased to implement as | |
606 | part of my work at QuanSight and sponsored by DE Shaw. |
|
646 | part of my work at QuanSight and sponsored by DE Shaw. | |
607 |
|
647 | |||
608 | Traceback improvements |
|
648 | Traceback improvements | |
609 | ~~~~~~~~~~~~~~~~~~~~~~ |
|
649 | ~~~~~~~~~~~~~~~~~~~~~~ | |
610 |
|
650 | |||
611 | Previously, error tracebacks for errors happening in code cells were showing a |
|
651 | Previously, error tracebacks for errors happening in code cells were showing a | |
612 | hash, the one used for compiling the Python AST:: |
|
652 | hash, the one used for compiling the Python AST:: | |
613 |
|
653 | |||
614 | In [1]: def foo(): |
|
654 | In [1]: def foo(): | |
615 | ...: return 3 / 0 |
|
655 | ...: return 3 / 0 | |
616 | ...: |
|
656 | ...: | |
617 |
|
657 | |||
618 | In [2]: foo() |
|
658 | In [2]: foo() | |
619 | --------------------------------------------------------------------------- |
|
659 | --------------------------------------------------------------------------- | |
620 | ZeroDivisionError Traceback (most recent call last) |
|
660 | ZeroDivisionError Traceback (most recent call last) | |
621 | <ipython-input-2-c19b6d9633cf> in <module> |
|
661 | <ipython-input-2-c19b6d9633cf> in <module> | |
622 | ----> 1 foo() |
|
662 | ----> 1 foo() | |
623 |
|
663 | |||
624 | <ipython-input-1-1595a74c32d5> in foo() |
|
664 | <ipython-input-1-1595a74c32d5> in foo() | |
625 | 1 def foo(): |
|
665 | 1 def foo(): | |
626 | ----> 2 return 3 / 0 |
|
666 | ----> 2 return 3 / 0 | |
627 | 3 |
|
667 | 3 | |
628 |
|
668 | |||
629 | ZeroDivisionError: division by zero |
|
669 | ZeroDivisionError: division by zero | |
630 |
|
670 | |||
631 | The error traceback is now correctly formatted, showing the cell number in which the error happened:: |
|
671 | The error traceback is now correctly formatted, showing the cell number in which the error happened:: | |
632 |
|
672 | |||
633 | In [1]: def foo(): |
|
673 | In [1]: def foo(): | |
634 | ...: return 3 / 0 |
|
674 | ...: return 3 / 0 | |
635 | ...: |
|
675 | ...: | |
636 |
|
676 | |||
637 | Input In [2]: foo() |
|
677 | Input In [2]: foo() | |
638 | --------------------------------------------------------------------------- |
|
678 | --------------------------------------------------------------------------- | |
639 | ZeroDivisionError Traceback (most recent call last) |
|
679 | ZeroDivisionError Traceback (most recent call last) | |
640 | input In [2], in <module> |
|
680 | input In [2], in <module> | |
641 | ----> 1 foo() |
|
681 | ----> 1 foo() | |
642 |
|
682 | |||
643 | Input In [1], in foo() |
|
683 | Input In [1], in foo() | |
644 | 1 def foo(): |
|
684 | 1 def foo(): | |
645 | ----> 2 return 3 / 0 |
|
685 | ----> 2 return 3 / 0 | |
646 |
|
686 | |||
647 | ZeroDivisionError: division by zero |
|
687 | ZeroDivisionError: division by zero | |
648 |
|
688 | |||
649 | The ``stack_data`` package has been integrated, which provides smarter information in the traceback; |
|
689 | The ``stack_data`` package has been integrated, which provides smarter information in the traceback; | |
650 | in particular it will highlight the AST node where an error occurs which can help to quickly narrow down errors. |
|
690 | in particular it will highlight the AST node where an error occurs which can help to quickly narrow down errors. | |
651 |
|
691 | |||
652 | For example in the following snippet:: |
|
692 | For example in the following snippet:: | |
653 |
|
693 | |||
654 | def foo(i): |
|
694 | def foo(i): | |
655 | x = [[[0]]] |
|
695 | x = [[[0]]] | |
656 | return x[0][i][0] |
|
696 | return x[0][i][0] | |
657 |
|
697 | |||
658 |
|
698 | |||
659 | def bar(): |
|
699 | def bar(): | |
660 | return foo(0) + foo( |
|
700 | return foo(0) + foo( | |
661 | 1 |
|
701 | 1 | |
662 | ) + foo(2) |
|
702 | ) + foo(2) | |
663 |
|
703 | |||
664 |
|
704 | |||
665 | calling ``bar()`` would raise an ``IndexError`` on the return line of ``foo``, |
|
705 | calling ``bar()`` would raise an ``IndexError`` on the return line of ``foo``, | |
666 | and IPython 8.0 is capable of telling you where the index error occurs:: |
|
706 | and IPython 8.0 is capable of telling you where the index error occurs:: | |
667 |
|
707 | |||
668 |
|
708 | |||
669 | IndexError |
|
709 | IndexError | |
670 | Input In [2], in <module> |
|
710 | Input In [2], in <module> | |
671 | ----> 1 bar() |
|
711 | ----> 1 bar() | |
672 | ^^^^^ |
|
712 | ^^^^^ | |
673 |
|
713 | |||
674 | Input In [1], in bar() |
|
714 | Input In [1], in bar() | |
675 | 6 def bar(): |
|
715 | 6 def bar(): | |
676 | ----> 7 return foo(0) + foo( |
|
716 | ----> 7 return foo(0) + foo( | |
677 | ^^^^ |
|
717 | ^^^^ | |
678 | 8 1 |
|
718 | 8 1 | |
679 | ^^^^^^^^ |
|
719 | ^^^^^^^^ | |
680 | 9 ) + foo(2) |
|
720 | 9 ) + foo(2) | |
681 | ^^^^ |
|
721 | ^^^^ | |
682 |
|
722 | |||
683 | Input In [1], in foo(i) |
|
723 | Input In [1], in foo(i) | |
684 | 1 def foo(i): |
|
724 | 1 def foo(i): | |
685 | 2 x = [[[0]]] |
|
725 | 2 x = [[[0]]] | |
686 | ----> 3 return x[0][i][0] |
|
726 | ----> 3 return x[0][i][0] | |
687 | ^^^^^^^ |
|
727 | ^^^^^^^ | |
688 |
|
728 | |||
689 | The corresponding locations marked here with ``^`` will show up highlighted in |
|
729 | The corresponding locations marked here with ``^`` will show up highlighted in | |
690 | the terminal and notebooks. |
|
730 | the terminal and notebooks. | |
691 |
|
731 | |||
692 | Finally, a colon ``::`` and line number is appended after a filename in |
|
732 | Finally, a colon ``::`` and line number is appended after a filename in | |
693 | traceback:: |
|
733 | traceback:: | |
694 |
|
734 | |||
695 |
|
735 | |||
696 | ZeroDivisionError Traceback (most recent call last) |
|
736 | ZeroDivisionError Traceback (most recent call last) | |
697 | File ~/error.py:4, in <module> |
|
737 | File ~/error.py:4, in <module> | |
698 | 1 def f(): |
|
738 | 1 def f(): | |
699 | 2 1/0 |
|
739 | 2 1/0 | |
700 | ----> 4 f() |
|
740 | ----> 4 f() | |
701 |
|
741 | |||
702 | File ~/error.py:2, in f() |
|
742 | File ~/error.py:2, in f() | |
703 | 1 def f(): |
|
743 | 1 def f(): | |
704 | ----> 2 1/0 |
|
744 | ----> 2 1/0 | |
705 |
|
745 | |||
706 | Many terminals and editors have integrations enabling you to directly jump to the |
|
746 | Many terminals and editors have integrations enabling you to directly jump to the | |
707 | relevant file/line when this syntax is used, so this small addition may have a high |
|
747 | relevant file/line when this syntax is used, so this small addition may have a high | |
708 | impact on productivity. |
|
748 | impact on productivity. | |
709 |
|
749 | |||
710 |
|
750 | |||
711 | Autosuggestions |
|
751 | Autosuggestions | |
712 | ~~~~~~~~~~~~~~~ |
|
752 | ~~~~~~~~~~~~~~~ | |
713 |
|
753 | |||
714 | Autosuggestion is a very useful feature available in `fish <https://fishshell.com/>`__, `zsh <https://en.wikipedia.org/wiki/Z_shell>`__, and `prompt-toolkit <https://python-prompt-toolkit.readthedocs.io/en/master/pages/asking_for_input.html#auto-suggestion>`__. |
|
754 | Autosuggestion is a very useful feature available in `fish <https://fishshell.com/>`__, `zsh <https://en.wikipedia.org/wiki/Z_shell>`__, and `prompt-toolkit <https://python-prompt-toolkit.readthedocs.io/en/master/pages/asking_for_input.html#auto-suggestion>`__. | |
715 |
|
755 | |||
716 | `Ptpython <https://github.com/prompt-toolkit/ptpython#ptpython>`__ allows users to enable this feature in |
|
756 | `Ptpython <https://github.com/prompt-toolkit/ptpython#ptpython>`__ allows users to enable this feature in | |
717 | `ptpython/config.py <https://github.com/prompt-toolkit/ptpython/blob/master/examples/ptpython_config/config.py#L90>`__. |
|
757 | `ptpython/config.py <https://github.com/prompt-toolkit/ptpython/blob/master/examples/ptpython_config/config.py#L90>`__. | |
718 |
|
758 | |||
719 | This feature allows users to accept autosuggestions with ctrl e, ctrl f, |
|
759 | This feature allows users to accept autosuggestions with ctrl e, ctrl f, | |
720 | or right arrow as described below. |
|
760 | or right arrow as described below. | |
721 |
|
761 | |||
722 | 1. Start ipython |
|
762 | 1. Start ipython | |
723 |
|
763 | |||
724 | .. image:: ../_images/8.0/auto_suggest_1_prompt_no_text.png |
|
764 | .. image:: ../_images/8.0/auto_suggest_1_prompt_no_text.png | |
725 |
|
765 | |||
726 | 2. Run ``print("hello")`` |
|
766 | 2. Run ``print("hello")`` | |
727 |
|
767 | |||
728 | .. image:: ../_images/8.0/auto_suggest_2_print_hello_suggest.png |
|
768 | .. image:: ../_images/8.0/auto_suggest_2_print_hello_suggest.png | |
729 |
|
769 | |||
730 | 3. start typing ``print`` again to see the autosuggestion |
|
770 | 3. start typing ``print`` again to see the autosuggestion | |
731 |
|
771 | |||
732 | .. image:: ../_images/8.0/auto_suggest_3_print_hello_suggest.png |
|
772 | .. image:: ../_images/8.0/auto_suggest_3_print_hello_suggest.png | |
733 |
|
773 | |||
734 | 4. Press ``ctrl-f``, or ``ctrl-e``, or ``right-arrow`` to accept the suggestion |
|
774 | 4. Press ``ctrl-f``, or ``ctrl-e``, or ``right-arrow`` to accept the suggestion | |
735 |
|
775 | |||
736 | .. image:: ../_images/8.0/auto_suggest_4_print_hello.png |
|
776 | .. image:: ../_images/8.0/auto_suggest_4_print_hello.png | |
737 |
|
777 | |||
738 | You can also complete word by word: |
|
778 | You can also complete word by word: | |
739 |
|
779 | |||
740 | 1. Run ``def say_hello(): print("hello")`` |
|
780 | 1. Run ``def say_hello(): print("hello")`` | |
741 |
|
781 | |||
742 | .. image:: ../_images/8.0/auto_suggest_second_prompt.png |
|
782 | .. image:: ../_images/8.0/auto_suggest_second_prompt.png | |
743 |
|
783 | |||
744 | 2. Start typing the first letter if ``def`` to see the autosuggestion |
|
784 | 2. Start typing the first letter if ``def`` to see the autosuggestion | |
745 |
|
785 | |||
746 | .. image:: ../_images/8.0/auto_suggest_d_phantom.png |
|
786 | .. image:: ../_images/8.0/auto_suggest_d_phantom.png | |
747 |
|
787 | |||
748 | 3. Press ``alt-f`` (or ``escape`` followed by ``f``), to accept the first word of the suggestion |
|
788 | 3. Press ``alt-f`` (or ``escape`` followed by ``f``), to accept the first word of the suggestion | |
749 |
|
789 | |||
750 | .. image:: ../_images/8.0/auto_suggest_def_phantom.png |
|
790 | .. image:: ../_images/8.0/auto_suggest_def_phantom.png | |
751 |
|
791 | |||
752 | Importantly, this feature does not interfere with tab completion: |
|
792 | Importantly, this feature does not interfere with tab completion: | |
753 |
|
793 | |||
754 | 1. After running ``def say_hello(): print("hello")``, press d |
|
794 | 1. After running ``def say_hello(): print("hello")``, press d | |
755 |
|
795 | |||
756 | .. image:: ../_images/8.0/auto_suggest_d_phantom.png |
|
796 | .. image:: ../_images/8.0/auto_suggest_d_phantom.png | |
757 |
|
797 | |||
758 | 2. Press Tab to start tab completion |
|
798 | 2. Press Tab to start tab completion | |
759 |
|
799 | |||
760 | .. image:: ../_images/8.0/auto_suggest_d_completions.png |
|
800 | .. image:: ../_images/8.0/auto_suggest_d_completions.png | |
761 |
|
801 | |||
762 | 3A. Press Tab again to select the first option |
|
802 | 3A. Press Tab again to select the first option | |
763 |
|
803 | |||
764 | .. image:: ../_images/8.0/auto_suggest_def_completions.png |
|
804 | .. image:: ../_images/8.0/auto_suggest_def_completions.png | |
765 |
|
805 | |||
766 | 3B. Press ``alt f`` (``escape``, ``f``) to accept to accept the first word of the suggestion |
|
806 | 3B. Press ``alt f`` (``escape``, ``f``) to accept to accept the first word of the suggestion | |
767 |
|
807 | |||
768 | .. image:: ../_images/8.0/auto_suggest_def_phantom.png |
|
808 | .. image:: ../_images/8.0/auto_suggest_def_phantom.png | |
769 |
|
809 | |||
770 | 3C. Press ``ctrl-f`` or ``ctrl-e`` to accept the entire suggestion |
|
810 | 3C. Press ``ctrl-f`` or ``ctrl-e`` to accept the entire suggestion | |
771 |
|
811 | |||
772 | .. image:: ../_images/8.0/auto_suggest_match_parens.png |
|
812 | .. image:: ../_images/8.0/auto_suggest_match_parens.png | |
773 |
|
813 | |||
774 |
|
814 | |||
775 | Currently, autosuggestions are only shown in the emacs or vi insert editing modes: |
|
815 | Currently, autosuggestions are only shown in the emacs or vi insert editing modes: | |
776 |
|
816 | |||
777 | - The ctrl e, ctrl f, and alt f shortcuts work by default in emacs mode. |
|
817 | - The ctrl e, ctrl f, and alt f shortcuts work by default in emacs mode. | |
778 | - To use these shortcuts in vi insert mode, you will have to create `custom keybindings in your config.py <https://github.com/mskar/setup/commit/2892fcee46f9f80ef7788f0749edc99daccc52f4/>`__. |
|
818 | - To use these shortcuts in vi insert mode, you will have to create `custom keybindings in your config.py <https://github.com/mskar/setup/commit/2892fcee46f9f80ef7788f0749edc99daccc52f4/>`__. | |
779 |
|
819 | |||
780 |
|
820 | |||
781 | Show pinfo information in ipdb using "?" and "??" |
|
821 | Show pinfo information in ipdb using "?" and "??" | |
782 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
822 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
783 |
|
823 | |||
784 | In IPDB, it is now possible to show the information about an object using "?" |
|
824 | In IPDB, it is now possible to show the information about an object using "?" | |
785 | and "??", in much the same way that it can be done when using the IPython prompt:: |
|
825 | and "??", in much the same way that it can be done when using the IPython prompt:: | |
786 |
|
826 | |||
787 | ipdb> partial? |
|
827 | ipdb> partial? | |
788 | Init signature: partial(self, /, *args, **kwargs) |
|
828 | Init signature: partial(self, /, *args, **kwargs) | |
789 | Docstring: |
|
829 | Docstring: | |
790 | partial(func, *args, **keywords) - new function with partial application |
|
830 | partial(func, *args, **keywords) - new function with partial application | |
791 | of the given arguments and keywords. |
|
831 | of the given arguments and keywords. | |
792 | File: ~/.pyenv/versions/3.8.6/lib/python3.8/functools.py |
|
832 | File: ~/.pyenv/versions/3.8.6/lib/python3.8/functools.py | |
793 | Type: type |
|
833 | Type: type | |
794 | Subclasses: |
|
834 | Subclasses: | |
795 |
|
835 | |||
796 | Previously, ``pinfo`` or ``pinfo2`` command had to be used for this purpose. |
|
836 | Previously, ``pinfo`` or ``pinfo2`` command had to be used for this purpose. | |
797 |
|
837 | |||
798 |
|
838 | |||
799 | Autoreload 3 feature |
|
839 | Autoreload 3 feature | |
800 | ~~~~~~~~~~~~~~~~~~~~ |
|
840 | ~~~~~~~~~~~~~~~~~~~~ | |
801 |
|
841 | |||
802 | Example: When an IPython session is run with the 'autoreload' extension loaded, |
|
842 | Example: When an IPython session is run with the 'autoreload' extension loaded, | |
803 | you will now have the option '3' to select, which means the following: |
|
843 | you will now have the option '3' to select, which means the following: | |
804 |
|
844 | |||
805 | 1. replicate all functionality from option 2 |
|
845 | 1. replicate all functionality from option 2 | |
806 | 2. autoload all new funcs/classes/enums/globals from the module when they are added |
|
846 | 2. autoload all new funcs/classes/enums/globals from the module when they are added | |
807 | 3. autoload all newly imported funcs/classes/enums/globals from external modules |
|
847 | 3. autoload all newly imported funcs/classes/enums/globals from external modules | |
808 |
|
848 | |||
809 | Try ``%autoreload 3`` in an IPython session after running ``%load_ext autoreload``. |
|
849 | Try ``%autoreload 3`` in an IPython session after running ``%load_ext autoreload``. | |
810 |
|
850 | |||
811 | For more information please see the following unit test : ``extensions/tests/test_autoreload.py:test_autoload_newly_added_objects`` |
|
851 | For more information please see the following unit test : ``extensions/tests/test_autoreload.py:test_autoload_newly_added_objects`` | |
812 |
|
852 | |||
813 | Auto formatting with black in the CLI |
|
853 | Auto formatting with black in the CLI | |
814 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
854 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
815 |
|
855 | |||
816 | This feature was present in 7.x, but disabled by default. |
|
856 | This feature was present in 7.x, but disabled by default. | |
817 |
|
857 | |||
818 | In 8.0, input was automatically reformatted with Black when black was installed. |
|
858 | In 8.0, input was automatically reformatted with Black when black was installed. | |
819 | This feature has been reverted for the time being. |
|
859 | This feature has been reverted for the time being. | |
820 | You can re-enable it by setting ``TerminalInteractiveShell.autoformatter`` to ``"black"`` |
|
860 | You can re-enable it by setting ``TerminalInteractiveShell.autoformatter`` to ``"black"`` | |
821 |
|
861 | |||
822 | History Range Glob feature |
|
862 | History Range Glob feature | |
823 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
863 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
824 |
|
864 | |||
825 | Previously, when using ``%history``, users could specify either |
|
865 | Previously, when using ``%history``, users could specify either | |
826 | a range of sessions and lines, for example: |
|
866 | a range of sessions and lines, for example: | |
827 |
|
867 | |||
828 | .. code-block:: python |
|
868 | .. code-block:: python | |
829 |
|
869 | |||
830 | ~8/1-~6/5 # see history from the first line of 8 sessions ago, |
|
870 | ~8/1-~6/5 # see history from the first line of 8 sessions ago, | |
831 | # to the fifth line of 6 sessions ago.`` |
|
871 | # to the fifth line of 6 sessions ago.`` | |
832 |
|
872 | |||
833 | Or users could specify a glob pattern: |
|
873 | Or users could specify a glob pattern: | |
834 |
|
874 | |||
835 | .. code-block:: python |
|
875 | .. code-block:: python | |
836 |
|
876 | |||
837 | -g <pattern> # glob ALL history for the specified pattern. |
|
877 | -g <pattern> # glob ALL history for the specified pattern. | |
838 |
|
878 | |||
839 | However users could *not* specify both. |
|
879 | However users could *not* specify both. | |
840 |
|
880 | |||
841 | If a user *did* specify both a range and a glob pattern, |
|
881 | If a user *did* specify both a range and a glob pattern, | |
842 | then the glob pattern would be used (globbing *all* history) *and the range would be ignored*. |
|
882 | then the glob pattern would be used (globbing *all* history) *and the range would be ignored*. | |
843 |
|
883 | |||
844 | With this enhancement, if a user specifies both a range and a glob pattern, then the glob pattern will be applied to the specified range of history. |
|
884 | With this enhancement, if a user specifies both a range and a glob pattern, then the glob pattern will be applied to the specified range of history. | |
845 |
|
885 | |||
846 | Don't start a multi-line cell with sunken parenthesis |
|
886 | Don't start a multi-line cell with sunken parenthesis | |
847 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
887 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
848 |
|
888 | |||
849 | From now on, IPython will not ask for the next line of input when given a single |
|
889 | From now on, IPython will not ask for the next line of input when given a single | |
850 | line with more closing than opening brackets. For example, this means that if |
|
890 | line with more closing than opening brackets. For example, this means that if | |
851 | you (mis)type ``]]`` instead of ``[]``, a ``SyntaxError`` will show up, instead of |
|
891 | you (mis)type ``]]`` instead of ``[]``, a ``SyntaxError`` will show up, instead of | |
852 | the ``...:`` prompt continuation. |
|
892 | the ``...:`` prompt continuation. | |
853 |
|
893 | |||
854 | IPython shell for ipdb interact |
|
894 | IPython shell for ipdb interact | |
855 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
895 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
856 |
|
896 | |||
857 | The ipdb ``interact`` starts an IPython shell instead of Python's built-in ``code.interact()``. |
|
897 | The ipdb ``interact`` starts an IPython shell instead of Python's built-in ``code.interact()``. | |
858 |
|
898 | |||
859 | Automatic Vi prompt stripping |
|
899 | Automatic Vi prompt stripping | |
860 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
900 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
861 |
|
901 | |||
862 | When pasting code into IPython, it will strip the leading prompt characters if |
|
902 | When pasting code into IPython, it will strip the leading prompt characters if | |
863 | there are any. For example, you can paste the following code into the console - |
|
903 | there are any. For example, you can paste the following code into the console - | |
864 | it will still work, even though each line is prefixed with prompts (``In``, |
|
904 | it will still work, even though each line is prefixed with prompts (``In``, | |
865 | ``Out``):: |
|
905 | ``Out``):: | |
866 |
|
906 | |||
867 | In [1]: 2 * 2 == 4 |
|
907 | In [1]: 2 * 2 == 4 | |
868 | Out[1]: True |
|
908 | Out[1]: True | |
869 |
|
909 | |||
870 | In [2]: print("This still works as pasted") |
|
910 | In [2]: print("This still works as pasted") | |
871 |
|
911 | |||
872 |
|
912 | |||
873 | Previously, this was not the case for the Vi-mode prompts:: |
|
913 | Previously, this was not the case for the Vi-mode prompts:: | |
874 |
|
914 | |||
875 | In [1]: [ins] In [13]: 2 * 2 == 4 |
|
915 | In [1]: [ins] In [13]: 2 * 2 == 4 | |
876 | ...: Out[13]: True |
|
916 | ...: Out[13]: True | |
877 | ...: |
|
917 | ...: | |
878 | File "<ipython-input-1-727bb88eaf33>", line 1 |
|
918 | File "<ipython-input-1-727bb88eaf33>", line 1 | |
879 | [ins] In [13]: 2 * 2 == 4 |
|
919 | [ins] In [13]: 2 * 2 == 4 | |
880 | ^ |
|
920 | ^ | |
881 | SyntaxError: invalid syntax |
|
921 | SyntaxError: invalid syntax | |
882 |
|
922 | |||
883 | This is now fixed, and Vi prompt prefixes - ``[ins]`` and ``[nav]`` - are |
|
923 | This is now fixed, and Vi prompt prefixes - ``[ins]`` and ``[nav]`` - are | |
884 | skipped just as the normal ``In`` would be. |
|
924 | skipped just as the normal ``In`` would be. | |
885 |
|
925 | |||
886 | IPython shell can be started in the Vi mode using ``ipython --TerminalInteractiveShell.editing_mode=vi``, |
|
926 | IPython shell can be started in the Vi mode using ``ipython --TerminalInteractiveShell.editing_mode=vi``, | |
887 | You should be able to change mode dynamically with ``%config TerminalInteractiveShell.editing_mode='vi'`` |
|
927 | You should be able to change mode dynamically with ``%config TerminalInteractiveShell.editing_mode='vi'`` | |
888 |
|
928 | |||
889 | Empty History Ranges |
|
929 | Empty History Ranges | |
890 | ~~~~~~~~~~~~~~~~~~~~ |
|
930 | ~~~~~~~~~~~~~~~~~~~~ | |
891 |
|
931 | |||
892 | A number of magics that take history ranges can now be used with an empty |
|
932 | A number of magics that take history ranges can now be used with an empty | |
893 | range. These magics are: |
|
933 | range. These magics are: | |
894 |
|
934 | |||
895 | * ``%save`` |
|
935 | * ``%save`` | |
896 | * ``%load`` |
|
936 | * ``%load`` | |
897 | * ``%pastebin`` |
|
937 | * ``%pastebin`` | |
898 | * ``%pycat`` |
|
938 | * ``%pycat`` | |
899 |
|
939 | |||
900 | Using them this way will make them take the history of the current session up |
|
940 | Using them this way will make them take the history of the current session up | |
901 | to the point of the magic call (such that the magic itself will not be |
|
941 | to the point of the magic call (such that the magic itself will not be | |
902 | included). |
|
942 | included). | |
903 |
|
943 | |||
904 | Therefore it is now possible to save the whole history to a file using |
|
944 | Therefore it is now possible to save the whole history to a file using | |
905 | ``%save <filename>``, load and edit it using ``%load`` (makes for a nice usage |
|
945 | ``%save <filename>``, load and edit it using ``%load`` (makes for a nice usage | |
906 | when followed with :kbd:`F2`), send it to `dpaste.org <http://dpast.org>`_ using |
|
946 | when followed with :kbd:`F2`), send it to `dpaste.org <http://dpast.org>`_ using | |
907 | ``%pastebin``, or view the whole thing syntax-highlighted with a single |
|
947 | ``%pastebin``, or view the whole thing syntax-highlighted with a single | |
908 | ``%pycat``. |
|
948 | ``%pycat``. | |
909 |
|
949 | |||
910 |
|
950 | |||
911 | Windows timing implementation: Switch to process_time |
|
951 | Windows timing implementation: Switch to process_time | |
912 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
952 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
913 | Timing on Windows, for example with ``%%time``, was changed from being based on ``time.perf_counter`` |
|
953 | Timing on Windows, for example with ``%%time``, was changed from being based on ``time.perf_counter`` | |
914 | (which counted time even when the process was sleeping) to being based on ``time.process_time`` instead |
|
954 | (which counted time even when the process was sleeping) to being based on ``time.process_time`` instead | |
915 | (which only counts CPU time). This brings it closer to the behavior on Linux. See :ghpull:`12984`. |
|
955 | (which only counts CPU time). This brings it closer to the behavior on Linux. See :ghpull:`12984`. | |
916 |
|
956 | |||
917 | Miscellaneous |
|
957 | Miscellaneous | |
918 | ~~~~~~~~~~~~~ |
|
958 | ~~~~~~~~~~~~~ | |
919 | - Non-text formatters are not disabled in the terminal, which should simplify |
|
959 | - Non-text formatters are not disabled in the terminal, which should simplify | |
920 | writing extensions displaying images or other mimetypes in supporting terminals. |
|
960 | writing extensions displaying images or other mimetypes in supporting terminals. | |
921 | :ghpull:`12315` |
|
961 | :ghpull:`12315` | |
922 | - It is now possible to automatically insert matching brackets in Terminal IPython using the |
|
962 | - It is now possible to automatically insert matching brackets in Terminal IPython using the | |
923 | ``TerminalInteractiveShell.auto_match=True`` option. :ghpull:`12586` |
|
963 | ``TerminalInteractiveShell.auto_match=True`` option. :ghpull:`12586` | |
924 | - We are thinking of deprecating the current ``%%javascript`` magic in favor of a better replacement. See :ghpull:`13376`. |
|
964 | - We are thinking of deprecating the current ``%%javascript`` magic in favor of a better replacement. See :ghpull:`13376`. | |
925 | - ``~`` is now expanded when part of a path in most magics :ghpull:`13385` |
|
965 | - ``~`` is now expanded when part of a path in most magics :ghpull:`13385` | |
926 | - ``%/%%timeit`` magic now adds a comma every thousands to make reading a long number easier :ghpull:`13379` |
|
966 | - ``%/%%timeit`` magic now adds a comma every thousands to make reading a long number easier :ghpull:`13379` | |
927 | - ``"info"`` messages can now be customised to hide some fields :ghpull:`13343` |
|
967 | - ``"info"`` messages can now be customised to hide some fields :ghpull:`13343` | |
928 | - ``collections.UserList`` now pretty-prints :ghpull:`13320` |
|
968 | - ``collections.UserList`` now pretty-prints :ghpull:`13320` | |
929 | - The debugger now has a persistent history, which should make it less |
|
969 | - The debugger now has a persistent history, which should make it less | |
930 | annoying to retype commands :ghpull:`13246` |
|
970 | annoying to retype commands :ghpull:`13246` | |
931 | - ``!pip`` ``!conda`` ``!cd`` or ``!ls`` are likely doing the wrong thing. We |
|
971 | - ``!pip`` ``!conda`` ``!cd`` or ``!ls`` are likely doing the wrong thing. We | |
932 | now warn users if they use one of those commands. :ghpull:`12954` |
|
972 | now warn users if they use one of those commands. :ghpull:`12954` | |
933 | - Make ``%precision`` work for ``numpy.float64`` type :ghpull:`12902` |
|
973 | - Make ``%precision`` work for ``numpy.float64`` type :ghpull:`12902` | |
934 |
|
974 | |||
935 | Re-added support for XDG config directories |
|
975 | Re-added support for XDG config directories | |
936 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
976 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
937 |
|
977 | |||
938 | XDG support through the years comes and goes. There is a tension between having |
|
978 | XDG support through the years comes and goes. There is a tension between having | |
939 | an identical location for configuration in all platforms versus having simple instructions. |
|
979 | an identical location for configuration in all platforms versus having simple instructions. | |
940 | After initial failures a couple of years ago, IPython was modified to automatically migrate XDG |
|
980 | After initial failures a couple of years ago, IPython was modified to automatically migrate XDG | |
941 | config files back into ``~/.ipython``. That migration code has now been removed. |
|
981 | config files back into ``~/.ipython``. That migration code has now been removed. | |
942 | IPython now checks the XDG locations, so if you _manually_ move your config |
|
982 | IPython now checks the XDG locations, so if you _manually_ move your config | |
943 | files to your preferred location, IPython will not move them back. |
|
983 | files to your preferred location, IPython will not move them back. | |
944 |
|
984 | |||
945 |
|
985 | |||
946 | Preparing for Python 3.10 |
|
986 | Preparing for Python 3.10 | |
947 | ------------------------- |
|
987 | ------------------------- | |
948 |
|
988 | |||
949 | To prepare for Python 3.10, we have started working on removing reliance and |
|
989 | To prepare for Python 3.10, we have started working on removing reliance and | |
950 | any dependency that is not compatible with Python 3.10. This includes migrating our |
|
990 | any dependency that is not compatible with Python 3.10. This includes migrating our | |
951 | test suite to pytest and starting to remove nose. This also means that the |
|
991 | test suite to pytest and starting to remove nose. This also means that the | |
952 | ``iptest`` command is now gone and all testing is via pytest. |
|
992 | ``iptest`` command is now gone and all testing is via pytest. | |
953 |
|
993 | |||
954 | This was in large part thanks to the NumFOCUS Small Developer grant, which enabled us to |
|
994 | This was in large part thanks to the NumFOCUS Small Developer grant, which enabled us to | |
955 | allocate \$4000 to hire `Nikita Kniazev (@Kojoley) <https://github.com/Kojoley>`_, |
|
995 | allocate \$4000 to hire `Nikita Kniazev (@Kojoley) <https://github.com/Kojoley>`_, | |
956 | who did a fantastic job at updating our code base, migrating to pytest, pushing |
|
996 | who did a fantastic job at updating our code base, migrating to pytest, pushing | |
957 | our coverage, and fixing a large number of bugs. I highly recommend contacting |
|
997 | our coverage, and fixing a large number of bugs. I highly recommend contacting | |
958 | them if you need help with C++ and Python projects. |
|
998 | them if you need help with C++ and Python projects. | |
959 |
|
999 | |||
960 | You can find all relevant issues and PRs with `the SDG 2021 tag <https://github.com/ipython/ipython/issues?q=label%3A%22Numfocus+SDG+2021%22+>`__ |
|
1000 | You can find all relevant issues and PRs with `the SDG 2021 tag <https://github.com/ipython/ipython/issues?q=label%3A%22Numfocus+SDG+2021%22+>`__ | |
961 |
|
1001 | |||
962 | Removing support for older Python versions |
|
1002 | Removing support for older Python versions | |
963 | ------------------------------------------ |
|
1003 | ------------------------------------------ | |
964 |
|
1004 | |||
965 |
|
1005 | |||
966 | We are removing support for Python up through 3.7, allowing internal code to use the more |
|
1006 | We are removing support for Python up through 3.7, allowing internal code to use the more | |
967 | efficient ``pathlib`` and to make better use of type annotations. |
|
1007 | efficient ``pathlib`` and to make better use of type annotations. | |
968 |
|
1008 | |||
969 | .. image:: ../_images/8.0/pathlib_pathlib_everywhere.jpg |
|
1009 | .. image:: ../_images/8.0/pathlib_pathlib_everywhere.jpg | |
970 | :alt: "Meme image of Toy Story with Woody and Buzz, with the text 'pathlib, pathlib everywhere'" |
|
1010 | :alt: "Meme image of Toy Story with Woody and Buzz, with the text 'pathlib, pathlib everywhere'" | |
971 |
|
1011 | |||
972 |
|
1012 | |||
973 | We had about 34 PRs only to update some logic to update some functions from managing strings to |
|
1013 | We had about 34 PRs only to update some logic to update some functions from managing strings to | |
974 | using Pathlib. |
|
1014 | using Pathlib. | |
975 |
|
1015 | |||
976 | The completer has also seen significant updates and now makes use of newer Jedi APIs, |
|
1016 | The completer has also seen significant updates and now makes use of newer Jedi APIs, | |
977 | offering faster and more reliable tab completion. |
|
1017 | offering faster and more reliable tab completion. | |
978 |
|
1018 | |||
979 | Misc Statistics |
|
1019 | Misc Statistics | |
980 | --------------- |
|
1020 | --------------- | |
981 |
|
1021 | |||
982 | Here are some numbers:: |
|
1022 | Here are some numbers:: | |
983 |
|
1023 | |||
984 | 7.x: 296 files, 12561 blank lines, 20282 comments, 35142 line of code. |
|
1024 | 7.x: 296 files, 12561 blank lines, 20282 comments, 35142 line of code. | |
985 | 8.0: 252 files, 12053 blank lines, 19232 comments, 34505 line of code. |
|
1025 | 8.0: 252 files, 12053 blank lines, 19232 comments, 34505 line of code. | |
986 |
|
1026 | |||
987 | $ git diff --stat 7.x...master | tail -1 |
|
1027 | $ git diff --stat 7.x...master | tail -1 | |
988 | 340 files changed, 13399 insertions(+), 12421 deletions(-) |
|
1028 | 340 files changed, 13399 insertions(+), 12421 deletions(-) | |
989 |
|
1029 | |||
990 | We have commits from 162 authors, who contributed 1916 commits in 23 month, excluding merges (to not bias toward |
|
1030 | We have commits from 162 authors, who contributed 1916 commits in 23 month, excluding merges (to not bias toward | |
991 | maintainers pushing buttons).:: |
|
1031 | maintainers pushing buttons).:: | |
992 |
|
1032 | |||
993 | $ git shortlog -s --no-merges 7.x...master | sort -nr |
|
1033 | $ git shortlog -s --no-merges 7.x...master | sort -nr | |
994 | 535 Matthias Bussonnier |
|
1034 | 535 Matthias Bussonnier | |
995 | 86 Nikita Kniazev |
|
1035 | 86 Nikita Kniazev | |
996 | 69 Blazej Michalik |
|
1036 | 69 Blazej Michalik | |
997 | 49 Samuel Gaist |
|
1037 | 49 Samuel Gaist | |
998 | 27 Itamar Turner-Trauring |
|
1038 | 27 Itamar Turner-Trauring | |
999 | 18 Spas Kalaydzhisyki |
|
1039 | 18 Spas Kalaydzhisyki | |
1000 | 17 Thomas Kluyver |
|
1040 | 17 Thomas Kluyver | |
1001 | 17 Quentin Peter |
|
1041 | 17 Quentin Peter | |
1002 | 17 James Morris |
|
1042 | 17 James Morris | |
1003 | 17 Artur Svistunov |
|
1043 | 17 Artur Svistunov | |
1004 | 15 Bart Skowron |
|
1044 | 15 Bart Skowron | |
1005 | 14 Alex Hall |
|
1045 | 14 Alex Hall | |
1006 | 13 rushabh-v |
|
1046 | 13 rushabh-v | |
1007 | 13 Terry Davis |
|
1047 | 13 Terry Davis | |
1008 | 13 Benjamin Ragan-Kelley |
|
1048 | 13 Benjamin Ragan-Kelley | |
1009 | 8 martinRenou |
|
1049 | 8 martinRenou | |
1010 | 8 farisachugthai |
|
1050 | 8 farisachugthai | |
1011 | 7 dswij |
|
1051 | 7 dswij | |
1012 | 7 Gal B |
|
1052 | 7 Gal B | |
1013 | 7 Corentin Cadiou |
|
1053 | 7 Corentin Cadiou | |
1014 | 6 yuji96 |
|
1054 | 6 yuji96 | |
1015 | 6 Martin Skarzynski |
|
1055 | 6 Martin Skarzynski | |
1016 | 6 Justin Palmer |
|
1056 | 6 Justin Palmer | |
1017 | 6 Daniel Goldfarb |
|
1057 | 6 Daniel Goldfarb | |
1018 | 6 Ben Greiner |
|
1058 | 6 Ben Greiner | |
1019 | 5 Sammy Al Hashemi |
|
1059 | 5 Sammy Al Hashemi | |
1020 | 5 Paul Ivanov |
|
1060 | 5 Paul Ivanov | |
1021 | 5 Inception95 |
|
1061 | 5 Inception95 | |
1022 | 5 Eyenpi |
|
1062 | 5 Eyenpi | |
1023 | 5 Douglas Blank |
|
1063 | 5 Douglas Blank | |
1024 | 5 Coco Mishra |
|
1064 | 5 Coco Mishra | |
1025 | 5 Bibo Hao |
|
1065 | 5 Bibo Hao | |
1026 | 5 AndrΓ© A. Gomes |
|
1066 | 5 AndrΓ© A. Gomes | |
1027 | 5 Ahmed Fasih |
|
1067 | 5 Ahmed Fasih | |
1028 | 4 takuya fujiwara |
|
1068 | 4 takuya fujiwara | |
1029 | 4 palewire |
|
1069 | 4 palewire | |
1030 | 4 Thomas A Caswell |
|
1070 | 4 Thomas A Caswell | |
1031 | 4 Talley Lambert |
|
1071 | 4 Talley Lambert | |
1032 | 4 Scott Sanderson |
|
1072 | 4 Scott Sanderson | |
1033 | 4 Ram Rachum |
|
1073 | 4 Ram Rachum | |
1034 | 4 Nick Muoh |
|
1074 | 4 Nick Muoh | |
1035 | 4 Nathan Goldbaum |
|
1075 | 4 Nathan Goldbaum | |
1036 | 4 Mithil Poojary |
|
1076 | 4 Mithil Poojary | |
1037 | 4 Michael T |
|
1077 | 4 Michael T | |
1038 | 4 Jakub Klus |
|
1078 | 4 Jakub Klus | |
1039 | 4 Ian Castleden |
|
1079 | 4 Ian Castleden | |
1040 | 4 Eli Rykoff |
|
1080 | 4 Eli Rykoff | |
1041 | 4 Ashwin Vishnu |
|
1081 | 4 Ashwin Vishnu | |
1042 | 3 θ°δΉιΌ |
|
1082 | 3 θ°δΉιΌ | |
1043 | 3 sleeping |
|
1083 | 3 sleeping | |
1044 | 3 Sylvain Corlay |
|
1084 | 3 Sylvain Corlay | |
1045 | 3 Peter Corke |
|
1085 | 3 Peter Corke | |
1046 | 3 Paul Bissex |
|
1086 | 3 Paul Bissex | |
1047 | 3 Matthew Feickert |
|
1087 | 3 Matthew Feickert | |
1048 | 3 Fernando Perez |
|
1088 | 3 Fernando Perez | |
1049 | 3 Eric Wieser |
|
1089 | 3 Eric Wieser | |
1050 | 3 Daniel Mietchen |
|
1090 | 3 Daniel Mietchen | |
1051 | 3 Aditya Sathe |
|
1091 | 3 Aditya Sathe | |
1052 | 3 007vedant |
|
1092 | 3 007vedant | |
1053 | 2 rchiodo |
|
1093 | 2 rchiodo | |
1054 | 2 nicolaslazo |
|
1094 | 2 nicolaslazo | |
1055 | 2 luttik |
|
1095 | 2 luttik | |
1056 | 2 gorogoroumaru |
|
1096 | 2 gorogoroumaru | |
1057 | 2 foobarbyte |
|
1097 | 2 foobarbyte | |
1058 | 2 bar-hen |
|
1098 | 2 bar-hen | |
1059 | 2 Theo Ouzhinski |
|
1099 | 2 Theo Ouzhinski | |
1060 | 2 Strawkage |
|
1100 | 2 Strawkage | |
1061 | 2 Samreen Zarroug |
|
1101 | 2 Samreen Zarroug | |
1062 | 2 Pete Blois |
|
1102 | 2 Pete Blois | |
1063 | 2 Meysam Azad |
|
1103 | 2 Meysam Azad | |
1064 | 2 Matthieu Ancellin |
|
1104 | 2 Matthieu Ancellin | |
1065 | 2 Mark Schmitz |
|
1105 | 2 Mark Schmitz | |
1066 | 2 Maor Kleinberger |
|
1106 | 2 Maor Kleinberger | |
1067 | 2 MRCWirtz |
|
1107 | 2 MRCWirtz | |
1068 | 2 Lumir Balhar |
|
1108 | 2 Lumir Balhar | |
1069 | 2 Julien Rabinow |
|
1109 | 2 Julien Rabinow | |
1070 | 2 Juan Luis Cano RodrΓguez |
|
1110 | 2 Juan Luis Cano RodrΓguez | |
1071 | 2 Joyce Er |
|
1111 | 2 Joyce Er | |
1072 | 2 Jakub |
|
1112 | 2 Jakub | |
1073 | 2 Faris A Chugthai |
|
1113 | 2 Faris A Chugthai | |
1074 | 2 Ethan Madden |
|
1114 | 2 Ethan Madden | |
1075 | 2 Dimitri Papadopoulos |
|
1115 | 2 Dimitri Papadopoulos | |
1076 | 2 Diego Fernandez |
|
1116 | 2 Diego Fernandez | |
1077 | 2 Daniel Shimon |
|
1117 | 2 Daniel Shimon | |
1078 | 2 Coco Bennett |
|
1118 | 2 Coco Bennett | |
1079 | 2 Carlos Cordoba |
|
1119 | 2 Carlos Cordoba | |
1080 | 2 Boyuan Liu |
|
1120 | 2 Boyuan Liu | |
1081 | 2 BaoGiang HoangVu |
|
1121 | 2 BaoGiang HoangVu | |
1082 | 2 Augusto |
|
1122 | 2 Augusto | |
1083 | 2 Arthur Svistunov |
|
1123 | 2 Arthur Svistunov | |
1084 | 2 Arthur Moreira |
|
1124 | 2 Arthur Moreira | |
1085 | 2 Ali Nabipour |
|
1125 | 2 Ali Nabipour | |
1086 | 2 Adam Hackbarth |
|
1126 | 2 Adam Hackbarth | |
1087 | 1 richard |
|
1127 | 1 richard | |
1088 | 1 linar-jether |
|
1128 | 1 linar-jether | |
1089 | 1 lbennett |
|
1129 | 1 lbennett | |
1090 | 1 juacrumar |
|
1130 | 1 juacrumar | |
1091 | 1 gpotter2 |
|
1131 | 1 gpotter2 | |
1092 | 1 digitalvirtuoso |
|
1132 | 1 digitalvirtuoso | |
1093 | 1 dalthviz |
|
1133 | 1 dalthviz | |
1094 | 1 Yonatan Goldschmidt |
|
1134 | 1 Yonatan Goldschmidt | |
1095 | 1 Tomasz KΕoczko |
|
1135 | 1 Tomasz KΕoczko | |
1096 | 1 Tobias Bengfort |
|
1136 | 1 Tobias Bengfort | |
1097 | 1 Timur Kushukov |
|
1137 | 1 Timur Kushukov | |
1098 | 1 Thomas |
|
1138 | 1 Thomas | |
1099 | 1 Snir Broshi |
|
1139 | 1 Snir Broshi | |
1100 | 1 Shao Yang Hong |
|
1140 | 1 Shao Yang Hong | |
1101 | 1 Sanjana-03 |
|
1141 | 1 Sanjana-03 | |
1102 | 1 Romulo Filho |
|
1142 | 1 Romulo Filho | |
1103 | 1 Rodolfo Carvalho |
|
1143 | 1 Rodolfo Carvalho | |
1104 | 1 Richard Shadrach |
|
1144 | 1 Richard Shadrach | |
1105 | 1 Reilly Tucker Siemens |
|
1145 | 1 Reilly Tucker Siemens | |
1106 | 1 Rakessh Roshan |
|
1146 | 1 Rakessh Roshan | |
1107 | 1 Piers Titus van der Torren |
|
1147 | 1 Piers Titus van der Torren | |
1108 | 1 PhanatosZou |
|
1148 | 1 PhanatosZou | |
1109 | 1 Pavel Safronov |
|
1149 | 1 Pavel Safronov | |
1110 | 1 Paulo S. Costa |
|
1150 | 1 Paulo S. Costa | |
1111 | 1 Paul McCarthy |
|
1151 | 1 Paul McCarthy | |
1112 | 1 NotWearingPants |
|
1152 | 1 NotWearingPants | |
1113 | 1 Naelson Douglas |
|
1153 | 1 Naelson Douglas | |
1114 | 1 Michael Tiemann |
|
1154 | 1 Michael Tiemann | |
1115 | 1 Matt Wozniski |
|
1155 | 1 Matt Wozniski | |
1116 | 1 Markus Wageringel |
|
1156 | 1 Markus Wageringel | |
1117 | 1 Marcus Wirtz |
|
1157 | 1 Marcus Wirtz | |
1118 | 1 Marcio Mazza |
|
1158 | 1 Marcio Mazza | |
1119 | 1 LumΓr 'Frenzy' Balhar |
|
1159 | 1 LumΓr 'Frenzy' Balhar | |
1120 | 1 Lightyagami1 |
|
1160 | 1 Lightyagami1 | |
1121 | 1 Leon Anavi |
|
1161 | 1 Leon Anavi | |
1122 | 1 LeafyLi |
|
1162 | 1 LeafyLi | |
1123 | 1 L0uisJ0shua |
|
1163 | 1 L0uisJ0shua | |
1124 | 1 Kyle Cutler |
|
1164 | 1 Kyle Cutler | |
1125 | 1 Krzysztof Cybulski |
|
1165 | 1 Krzysztof Cybulski | |
1126 | 1 Kevin Kirsche |
|
1166 | 1 Kevin Kirsche | |
1127 | 1 KIU Shueng Chuan |
|
1167 | 1 KIU Shueng Chuan | |
1128 | 1 Jonathan Slenders |
|
1168 | 1 Jonathan Slenders | |
1129 | 1 Jay Qi |
|
1169 | 1 Jay Qi | |
1130 | 1 Jake VanderPlas |
|
1170 | 1 Jake VanderPlas | |
1131 | 1 Iwan Briquemont |
|
1171 | 1 Iwan Briquemont | |
1132 | 1 Hussaina Begum Nandyala |
|
1172 | 1 Hussaina Begum Nandyala | |
1133 | 1 Gordon Ball |
|
1173 | 1 Gordon Ball | |
1134 | 1 Gabriel Simonetto |
|
1174 | 1 Gabriel Simonetto | |
1135 | 1 Frank Tobia |
|
1175 | 1 Frank Tobia | |
1136 | 1 Erik |
|
1176 | 1 Erik | |
1137 | 1 Elliott Sales de Andrade |
|
1177 | 1 Elliott Sales de Andrade | |
1138 | 1 Daniel Hahler |
|
1178 | 1 Daniel Hahler | |
1139 | 1 Dan Green-Leipciger |
|
1179 | 1 Dan Green-Leipciger | |
1140 | 1 Dan Green |
|
1180 | 1 Dan Green | |
1141 | 1 Damian Yurzola |
|
1181 | 1 Damian Yurzola | |
1142 | 1 Coon, Ethan T |
|
1182 | 1 Coon, Ethan T | |
1143 | 1 Carol Willing |
|
1183 | 1 Carol Willing | |
1144 | 1 Brian Lee |
|
1184 | 1 Brian Lee | |
1145 | 1 Brendan Gerrity |
|
1185 | 1 Brendan Gerrity | |
1146 | 1 Blake Griffin |
|
1186 | 1 Blake Griffin | |
1147 | 1 Bastian Ebeling |
|
1187 | 1 Bastian Ebeling | |
1148 | 1 Bartosz Telenczuk |
|
1188 | 1 Bartosz Telenczuk | |
1149 | 1 Ankitsingh6299 |
|
1189 | 1 Ankitsingh6299 | |
1150 | 1 Andrew Port |
|
1190 | 1 Andrew Port | |
1151 | 1 Andrew J. Hesford |
|
1191 | 1 Andrew J. Hesford | |
1152 | 1 Albert Zhang |
|
1192 | 1 Albert Zhang | |
1153 | 1 Adam Johnson |
|
1193 | 1 Adam Johnson | |
1154 |
|
1194 | |||
1155 | This does not, of course, represent non-code contributions, for which we are also grateful. |
|
1195 | This does not, of course, represent non-code contributions, for which we are also grateful. | |
1156 |
|
1196 | |||
1157 |
|
1197 | |||
1158 | API Changes using Frappuccino |
|
1198 | API Changes using Frappuccino | |
1159 | ----------------------------- |
|
1199 | ----------------------------- | |
1160 |
|
1200 | |||
1161 | This is an experimental exhaustive API difference using `Frappuccino <https://pypi.org/project/frappuccino/>`_ |
|
1201 | This is an experimental exhaustive API difference using `Frappuccino <https://pypi.org/project/frappuccino/>`_ | |
1162 |
|
1202 | |||
1163 |
|
1203 | |||
1164 | The following items are new in IPython 8.0 :: |
|
1204 | The following items are new in IPython 8.0 :: | |
1165 |
|
1205 | |||
1166 | + IPython.core.async_helpers.get_asyncio_loop() |
|
1206 | + IPython.core.async_helpers.get_asyncio_loop() | |
1167 | + IPython.core.completer.Dict |
|
1207 | + IPython.core.completer.Dict | |
1168 | + IPython.core.completer.Pattern |
|
1208 | + IPython.core.completer.Pattern | |
1169 | + IPython.core.completer.Sequence |
|
1209 | + IPython.core.completer.Sequence | |
1170 | + IPython.core.completer.__skip_doctest__ |
|
1210 | + IPython.core.completer.__skip_doctest__ | |
1171 | + IPython.core.debugger.Pdb.precmd(self, line) |
|
1211 | + IPython.core.debugger.Pdb.precmd(self, line) | |
1172 | + IPython.core.debugger.__skip_doctest__ |
|
1212 | + IPython.core.debugger.__skip_doctest__ | |
1173 | + IPython.core.display.__getattr__(name) |
|
1213 | + IPython.core.display.__getattr__(name) | |
1174 | + IPython.core.display.warn |
|
1214 | + IPython.core.display.warn | |
1175 | + IPython.core.display_functions |
|
1215 | + IPython.core.display_functions | |
1176 | + IPython.core.display_functions.DisplayHandle |
|
1216 | + IPython.core.display_functions.DisplayHandle | |
1177 | + IPython.core.display_functions.DisplayHandle.display(self, obj, **kwargs) |
|
1217 | + IPython.core.display_functions.DisplayHandle.display(self, obj, **kwargs) | |
1178 | + IPython.core.display_functions.DisplayHandle.update(self, obj, **kwargs) |
|
1218 | + IPython.core.display_functions.DisplayHandle.update(self, obj, **kwargs) | |
1179 | + IPython.core.display_functions.__all__ |
|
1219 | + IPython.core.display_functions.__all__ | |
1180 | + IPython.core.display_functions.__builtins__ |
|
1220 | + IPython.core.display_functions.__builtins__ | |
1181 | + IPython.core.display_functions.__cached__ |
|
1221 | + IPython.core.display_functions.__cached__ | |
1182 | + IPython.core.display_functions.__doc__ |
|
1222 | + IPython.core.display_functions.__doc__ | |
1183 | + IPython.core.display_functions.__file__ |
|
1223 | + IPython.core.display_functions.__file__ | |
1184 | + IPython.core.display_functions.__loader__ |
|
1224 | + IPython.core.display_functions.__loader__ | |
1185 | + IPython.core.display_functions.__name__ |
|
1225 | + IPython.core.display_functions.__name__ | |
1186 | + IPython.core.display_functions.__package__ |
|
1226 | + IPython.core.display_functions.__package__ | |
1187 | + IPython.core.display_functions.__spec__ |
|
1227 | + IPython.core.display_functions.__spec__ | |
1188 | + IPython.core.display_functions.b2a_hex |
|
1228 | + IPython.core.display_functions.b2a_hex | |
1189 | + IPython.core.display_functions.clear_output(wait=False) |
|
1229 | + IPython.core.display_functions.clear_output(wait=False) | |
1190 | + IPython.core.display_functions.display(*objs, include='None', exclude='None', metadata='None', transient='None', display_id='None', raw=False, clear=False, **kwargs) |
|
1230 | + IPython.core.display_functions.display(*objs, include='None', exclude='None', metadata='None', transient='None', display_id='None', raw=False, clear=False, **kwargs) | |
1191 | + IPython.core.display_functions.publish_display_data(data, metadata='None', source='<deprecated>', *, transient='None', **kwargs) |
|
1231 | + IPython.core.display_functions.publish_display_data(data, metadata='None', source='<deprecated>', *, transient='None', **kwargs) | |
1192 | + IPython.core.display_functions.update_display(obj, *, display_id, **kwargs) |
|
1232 | + IPython.core.display_functions.update_display(obj, *, display_id, **kwargs) | |
1193 | + IPython.core.extensions.BUILTINS_EXTS |
|
1233 | + IPython.core.extensions.BUILTINS_EXTS | |
1194 | + IPython.core.inputtransformer2.has_sunken_brackets(tokens) |
|
1234 | + IPython.core.inputtransformer2.has_sunken_brackets(tokens) | |
1195 | + IPython.core.interactiveshell.Callable |
|
1235 | + IPython.core.interactiveshell.Callable | |
1196 | + IPython.core.interactiveshell.__annotations__ |
|
1236 | + IPython.core.interactiveshell.__annotations__ | |
1197 | + IPython.core.ultratb.List |
|
1237 | + IPython.core.ultratb.List | |
1198 | + IPython.core.ultratb.Tuple |
|
1238 | + IPython.core.ultratb.Tuple | |
1199 | + IPython.lib.pretty.CallExpression |
|
1239 | + IPython.lib.pretty.CallExpression | |
1200 | + IPython.lib.pretty.CallExpression.factory(name) |
|
1240 | + IPython.lib.pretty.CallExpression.factory(name) | |
1201 | + IPython.lib.pretty.RawStringLiteral |
|
1241 | + IPython.lib.pretty.RawStringLiteral | |
1202 | + IPython.lib.pretty.RawText |
|
1242 | + IPython.lib.pretty.RawText | |
1203 | + IPython.terminal.debugger.TerminalPdb.do_interact(self, arg) |
|
1243 | + IPython.terminal.debugger.TerminalPdb.do_interact(self, arg) | |
1204 | + IPython.terminal.embed.Set |
|
1244 | + IPython.terminal.embed.Set | |
1205 |
|
1245 | |||
1206 | The following items have been removed (or moved to superclass):: |
|
1246 | The following items have been removed (or moved to superclass):: | |
1207 |
|
1247 | |||
1208 | - IPython.core.application.BaseIPythonApplication.initialize_subcommand |
|
1248 | - IPython.core.application.BaseIPythonApplication.initialize_subcommand | |
1209 | - IPython.core.completer.Sentinel |
|
1249 | - IPython.core.completer.Sentinel | |
1210 | - IPython.core.completer.skip_doctest |
|
1250 | - IPython.core.completer.skip_doctest | |
1211 | - IPython.core.debugger.Tracer |
|
1251 | - IPython.core.debugger.Tracer | |
1212 | - IPython.core.display.DisplayHandle |
|
1252 | - IPython.core.display.DisplayHandle | |
1213 | - IPython.core.display.DisplayHandle.display |
|
1253 | - IPython.core.display.DisplayHandle.display | |
1214 | - IPython.core.display.DisplayHandle.update |
|
1254 | - IPython.core.display.DisplayHandle.update | |
1215 | - IPython.core.display.b2a_hex |
|
1255 | - IPython.core.display.b2a_hex | |
1216 | - IPython.core.display.clear_output |
|
1256 | - IPython.core.display.clear_output | |
1217 | - IPython.core.display.display |
|
1257 | - IPython.core.display.display | |
1218 | - IPython.core.display.publish_display_data |
|
1258 | - IPython.core.display.publish_display_data | |
1219 | - IPython.core.display.update_display |
|
1259 | - IPython.core.display.update_display | |
1220 | - IPython.core.excolors.Deprec |
|
1260 | - IPython.core.excolors.Deprec | |
1221 | - IPython.core.excolors.ExceptionColors |
|
1261 | - IPython.core.excolors.ExceptionColors | |
1222 | - IPython.core.history.warn |
|
1262 | - IPython.core.history.warn | |
1223 | - IPython.core.hooks.late_startup_hook |
|
1263 | - IPython.core.hooks.late_startup_hook | |
1224 | - IPython.core.hooks.pre_run_code_hook |
|
1264 | - IPython.core.hooks.pre_run_code_hook | |
1225 | - IPython.core.hooks.shutdown_hook |
|
1265 | - IPython.core.hooks.shutdown_hook | |
1226 | - IPython.core.interactiveshell.InteractiveShell.init_deprecation_warnings |
|
1266 | - IPython.core.interactiveshell.InteractiveShell.init_deprecation_warnings | |
1227 | - IPython.core.interactiveshell.InteractiveShell.init_readline |
|
1267 | - IPython.core.interactiveshell.InteractiveShell.init_readline | |
1228 | - IPython.core.interactiveshell.InteractiveShell.write |
|
1268 | - IPython.core.interactiveshell.InteractiveShell.write | |
1229 | - IPython.core.interactiveshell.InteractiveShell.write_err |
|
1269 | - IPython.core.interactiveshell.InteractiveShell.write_err | |
1230 | - IPython.core.interactiveshell.get_default_colors |
|
1270 | - IPython.core.interactiveshell.get_default_colors | |
1231 | - IPython.core.interactiveshell.removed_co_newlocals |
|
1271 | - IPython.core.interactiveshell.removed_co_newlocals | |
1232 | - IPython.core.magics.execution.ExecutionMagics.profile_missing_notice |
|
1272 | - IPython.core.magics.execution.ExecutionMagics.profile_missing_notice | |
1233 | - IPython.core.magics.script.PIPE |
|
1273 | - IPython.core.magics.script.PIPE | |
1234 | - IPython.core.prefilter.PrefilterManager.init_transformers |
|
1274 | - IPython.core.prefilter.PrefilterManager.init_transformers | |
1235 | - IPython.core.release.classifiers |
|
1275 | - IPython.core.release.classifiers | |
1236 | - IPython.core.release.description |
|
1276 | - IPython.core.release.description | |
1237 | - IPython.core.release.keywords |
|
1277 | - IPython.core.release.keywords | |
1238 | - IPython.core.release.long_description |
|
1278 | - IPython.core.release.long_description | |
1239 | - IPython.core.release.name |
|
1279 | - IPython.core.release.name | |
1240 | - IPython.core.release.platforms |
|
1280 | - IPython.core.release.platforms | |
1241 | - IPython.core.release.url |
|
1281 | - IPython.core.release.url | |
1242 | - IPython.core.ultratb.VerboseTB.format_records |
|
1282 | - IPython.core.ultratb.VerboseTB.format_records | |
1243 | - IPython.core.ultratb.find_recursion |
|
1283 | - IPython.core.ultratb.find_recursion | |
1244 | - IPython.core.ultratb.findsource |
|
1284 | - IPython.core.ultratb.findsource | |
1245 | - IPython.core.ultratb.fix_frame_records_filenames |
|
1285 | - IPython.core.ultratb.fix_frame_records_filenames | |
1246 | - IPython.core.ultratb.inspect_error |
|
1286 | - IPython.core.ultratb.inspect_error | |
1247 | - IPython.core.ultratb.is_recursion_error |
|
1287 | - IPython.core.ultratb.is_recursion_error | |
1248 | - IPython.core.ultratb.with_patch_inspect |
|
1288 | - IPython.core.ultratb.with_patch_inspect | |
1249 | - IPython.external.__all__ |
|
1289 | - IPython.external.__all__ | |
1250 | - IPython.external.__builtins__ |
|
1290 | - IPython.external.__builtins__ | |
1251 | - IPython.external.__cached__ |
|
1291 | - IPython.external.__cached__ | |
1252 | - IPython.external.__doc__ |
|
1292 | - IPython.external.__doc__ | |
1253 | - IPython.external.__file__ |
|
1293 | - IPython.external.__file__ | |
1254 | - IPython.external.__loader__ |
|
1294 | - IPython.external.__loader__ | |
1255 | - IPython.external.__name__ |
|
1295 | - IPython.external.__name__ | |
1256 | - IPython.external.__package__ |
|
1296 | - IPython.external.__package__ | |
1257 | - IPython.external.__path__ |
|
1297 | - IPython.external.__path__ | |
1258 | - IPython.external.__spec__ |
|
1298 | - IPython.external.__spec__ | |
1259 | - IPython.kernel.KernelConnectionInfo |
|
1299 | - IPython.kernel.KernelConnectionInfo | |
1260 | - IPython.kernel.__builtins__ |
|
1300 | - IPython.kernel.__builtins__ | |
1261 | - IPython.kernel.__cached__ |
|
1301 | - IPython.kernel.__cached__ | |
1262 | - IPython.kernel.__warningregistry__ |
|
1302 | - IPython.kernel.__warningregistry__ | |
1263 | - IPython.kernel.pkg |
|
1303 | - IPython.kernel.pkg | |
1264 | - IPython.kernel.protocol_version |
|
1304 | - IPython.kernel.protocol_version | |
1265 | - IPython.kernel.protocol_version_info |
|
1305 | - IPython.kernel.protocol_version_info | |
1266 | - IPython.kernel.src |
|
1306 | - IPython.kernel.src | |
1267 | - IPython.kernel.version_info |
|
1307 | - IPython.kernel.version_info | |
1268 | - IPython.kernel.warn |
|
1308 | - IPython.kernel.warn | |
1269 | - IPython.lib.backgroundjobs |
|
1309 | - IPython.lib.backgroundjobs | |
1270 | - IPython.lib.backgroundjobs.BackgroundJobBase |
|
1310 | - IPython.lib.backgroundjobs.BackgroundJobBase | |
1271 | - IPython.lib.backgroundjobs.BackgroundJobBase.run |
|
1311 | - IPython.lib.backgroundjobs.BackgroundJobBase.run | |
1272 | - IPython.lib.backgroundjobs.BackgroundJobBase.traceback |
|
1312 | - IPython.lib.backgroundjobs.BackgroundJobBase.traceback | |
1273 | - IPython.lib.backgroundjobs.BackgroundJobExpr |
|
1313 | - IPython.lib.backgroundjobs.BackgroundJobExpr | |
1274 | - IPython.lib.backgroundjobs.BackgroundJobExpr.call |
|
1314 | - IPython.lib.backgroundjobs.BackgroundJobExpr.call | |
1275 | - IPython.lib.backgroundjobs.BackgroundJobFunc |
|
1315 | - IPython.lib.backgroundjobs.BackgroundJobFunc | |
1276 | - IPython.lib.backgroundjobs.BackgroundJobFunc.call |
|
1316 | - IPython.lib.backgroundjobs.BackgroundJobFunc.call | |
1277 | - IPython.lib.backgroundjobs.BackgroundJobManager |
|
1317 | - IPython.lib.backgroundjobs.BackgroundJobManager | |
1278 | - IPython.lib.backgroundjobs.BackgroundJobManager.flush |
|
1318 | - IPython.lib.backgroundjobs.BackgroundJobManager.flush | |
1279 | - IPython.lib.backgroundjobs.BackgroundJobManager.new |
|
1319 | - IPython.lib.backgroundjobs.BackgroundJobManager.new | |
1280 | - IPython.lib.backgroundjobs.BackgroundJobManager.remove |
|
1320 | - IPython.lib.backgroundjobs.BackgroundJobManager.remove | |
1281 | - IPython.lib.backgroundjobs.BackgroundJobManager.result |
|
1321 | - IPython.lib.backgroundjobs.BackgroundJobManager.result | |
1282 | - IPython.lib.backgroundjobs.BackgroundJobManager.status |
|
1322 | - IPython.lib.backgroundjobs.BackgroundJobManager.status | |
1283 | - IPython.lib.backgroundjobs.BackgroundJobManager.traceback |
|
1323 | - IPython.lib.backgroundjobs.BackgroundJobManager.traceback | |
1284 | - IPython.lib.backgroundjobs.__builtins__ |
|
1324 | - IPython.lib.backgroundjobs.__builtins__ | |
1285 | - IPython.lib.backgroundjobs.__cached__ |
|
1325 | - IPython.lib.backgroundjobs.__cached__ | |
1286 | - IPython.lib.backgroundjobs.__doc__ |
|
1326 | - IPython.lib.backgroundjobs.__doc__ | |
1287 | - IPython.lib.backgroundjobs.__file__ |
|
1327 | - IPython.lib.backgroundjobs.__file__ | |
1288 | - IPython.lib.backgroundjobs.__loader__ |
|
1328 | - IPython.lib.backgroundjobs.__loader__ | |
1289 | - IPython.lib.backgroundjobs.__name__ |
|
1329 | - IPython.lib.backgroundjobs.__name__ | |
1290 | - IPython.lib.backgroundjobs.__package__ |
|
1330 | - IPython.lib.backgroundjobs.__package__ | |
1291 | - IPython.lib.backgroundjobs.__spec__ |
|
1331 | - IPython.lib.backgroundjobs.__spec__ | |
1292 | - IPython.lib.kernel.__builtins__ |
|
1332 | - IPython.lib.kernel.__builtins__ | |
1293 | - IPython.lib.kernel.__cached__ |
|
1333 | - IPython.lib.kernel.__cached__ | |
1294 | - IPython.lib.kernel.__doc__ |
|
1334 | - IPython.lib.kernel.__doc__ | |
1295 | - IPython.lib.kernel.__file__ |
|
1335 | - IPython.lib.kernel.__file__ | |
1296 | - IPython.lib.kernel.__loader__ |
|
1336 | - IPython.lib.kernel.__loader__ | |
1297 | - IPython.lib.kernel.__name__ |
|
1337 | - IPython.lib.kernel.__name__ | |
1298 | - IPython.lib.kernel.__package__ |
|
1338 | - IPython.lib.kernel.__package__ | |
1299 | - IPython.lib.kernel.__spec__ |
|
1339 | - IPython.lib.kernel.__spec__ | |
1300 | - IPython.lib.kernel.__warningregistry__ |
|
1340 | - IPython.lib.kernel.__warningregistry__ | |
1301 | - IPython.paths.fs_encoding |
|
1341 | - IPython.paths.fs_encoding | |
1302 | - IPython.terminal.debugger.DEFAULT_BUFFER |
|
1342 | - IPython.terminal.debugger.DEFAULT_BUFFER | |
1303 | - IPython.terminal.debugger.cursor_in_leading_ws |
|
1343 | - IPython.terminal.debugger.cursor_in_leading_ws | |
1304 | - IPython.terminal.debugger.emacs_insert_mode |
|
1344 | - IPython.terminal.debugger.emacs_insert_mode | |
1305 | - IPython.terminal.debugger.has_selection |
|
1345 | - IPython.terminal.debugger.has_selection | |
1306 | - IPython.terminal.debugger.vi_insert_mode |
|
1346 | - IPython.terminal.debugger.vi_insert_mode | |
1307 | - IPython.terminal.interactiveshell.DISPLAY_BANNER_DEPRECATED |
|
1347 | - IPython.terminal.interactiveshell.DISPLAY_BANNER_DEPRECATED | |
1308 | - IPython.terminal.ipapp.TerminalIPythonApp.parse_command_line |
|
1348 | - IPython.terminal.ipapp.TerminalIPythonApp.parse_command_line | |
1309 | - IPython.testing.test |
|
1349 | - IPython.testing.test | |
1310 | - IPython.utils.contexts.NoOpContext |
|
1350 | - IPython.utils.contexts.NoOpContext | |
1311 | - IPython.utils.io.IOStream |
|
1351 | - IPython.utils.io.IOStream | |
1312 | - IPython.utils.io.IOStream.close |
|
1352 | - IPython.utils.io.IOStream.close | |
1313 | - IPython.utils.io.IOStream.write |
|
1353 | - IPython.utils.io.IOStream.write | |
1314 | - IPython.utils.io.IOStream.writelines |
|
1354 | - IPython.utils.io.IOStream.writelines | |
1315 | - IPython.utils.io.__warningregistry__ |
|
1355 | - IPython.utils.io.__warningregistry__ | |
1316 | - IPython.utils.io.atomic_writing |
|
1356 | - IPython.utils.io.atomic_writing | |
1317 | - IPython.utils.io.stderr |
|
1357 | - IPython.utils.io.stderr | |
1318 | - IPython.utils.io.stdin |
|
1358 | - IPython.utils.io.stdin | |
1319 | - IPython.utils.io.stdout |
|
1359 | - IPython.utils.io.stdout | |
1320 | - IPython.utils.io.unicode_std_stream |
|
1360 | - IPython.utils.io.unicode_std_stream | |
1321 | - IPython.utils.path.get_ipython_cache_dir |
|
1361 | - IPython.utils.path.get_ipython_cache_dir | |
1322 | - IPython.utils.path.get_ipython_dir |
|
1362 | - IPython.utils.path.get_ipython_dir | |
1323 | - IPython.utils.path.get_ipython_module_path |
|
1363 | - IPython.utils.path.get_ipython_module_path | |
1324 | - IPython.utils.path.get_ipython_package_dir |
|
1364 | - IPython.utils.path.get_ipython_package_dir | |
1325 | - IPython.utils.path.locate_profile |
|
1365 | - IPython.utils.path.locate_profile | |
1326 | - IPython.utils.path.unquote_filename |
|
1366 | - IPython.utils.path.unquote_filename | |
1327 | - IPython.utils.py3compat.PY2 |
|
1367 | - IPython.utils.py3compat.PY2 | |
1328 | - IPython.utils.py3compat.PY3 |
|
1368 | - IPython.utils.py3compat.PY3 | |
1329 | - IPython.utils.py3compat.buffer_to_bytes |
|
1369 | - IPython.utils.py3compat.buffer_to_bytes | |
1330 | - IPython.utils.py3compat.builtin_mod_name |
|
1370 | - IPython.utils.py3compat.builtin_mod_name | |
1331 | - IPython.utils.py3compat.cast_bytes |
|
1371 | - IPython.utils.py3compat.cast_bytes | |
1332 | - IPython.utils.py3compat.getcwd |
|
1372 | - IPython.utils.py3compat.getcwd | |
1333 | - IPython.utils.py3compat.isidentifier |
|
1373 | - IPython.utils.py3compat.isidentifier | |
1334 | - IPython.utils.py3compat.u_format |
|
1374 | - IPython.utils.py3compat.u_format | |
1335 |
|
1375 | |||
1336 | The following signatures differ between 7.x and 8.0:: |
|
1376 | The following signatures differ between 7.x and 8.0:: | |
1337 |
|
1377 | |||
1338 | - IPython.core.completer.IPCompleter.unicode_name_matches(self, text) |
|
1378 | - IPython.core.completer.IPCompleter.unicode_name_matches(self, text) | |
1339 | + IPython.core.completer.IPCompleter.unicode_name_matches(text) |
|
1379 | + IPython.core.completer.IPCompleter.unicode_name_matches(text) | |
1340 |
|
1380 | |||
1341 | - IPython.core.completer.match_dict_keys(keys, prefix, delims) |
|
1381 | - IPython.core.completer.match_dict_keys(keys, prefix, delims) | |
1342 | + IPython.core.completer.match_dict_keys(keys, prefix, delims, extra_prefix='None') |
|
1382 | + IPython.core.completer.match_dict_keys(keys, prefix, delims, extra_prefix='None') | |
1343 |
|
1383 | |||
1344 | - IPython.core.interactiveshell.InteractiveShell.object_inspect_mime(self, oname, detail_level=0) |
|
1384 | - IPython.core.interactiveshell.InteractiveShell.object_inspect_mime(self, oname, detail_level=0) | |
1345 | + IPython.core.interactiveshell.InteractiveShell.object_inspect_mime(self, oname, detail_level=0, omit_sections='()') |
|
1385 | + IPython.core.interactiveshell.InteractiveShell.object_inspect_mime(self, oname, detail_level=0, omit_sections='()') | |
1346 |
|
1386 | |||
1347 | - IPython.core.interactiveshell.InteractiveShell.set_hook(self, name, hook, priority=50, str_key='None', re_key='None', _warn_deprecated=True) |
|
1387 | - IPython.core.interactiveshell.InteractiveShell.set_hook(self, name, hook, priority=50, str_key='None', re_key='None', _warn_deprecated=True) | |
1348 | + IPython.core.interactiveshell.InteractiveShell.set_hook(self, name, hook, priority=50, str_key='None', re_key='None') |
|
1388 | + IPython.core.interactiveshell.InteractiveShell.set_hook(self, name, hook, priority=50, str_key='None', re_key='None') | |
1349 |
|
1389 | |||
1350 | - IPython.core.oinspect.Inspector.info(self, obj, oname='', formatter='None', info='None', detail_level=0) |
|
1390 | - IPython.core.oinspect.Inspector.info(self, obj, oname='', formatter='None', info='None', detail_level=0) | |
1351 | + IPython.core.oinspect.Inspector.info(self, obj, oname='', info='None', detail_level=0) |
|
1391 | + IPython.core.oinspect.Inspector.info(self, obj, oname='', info='None', detail_level=0) | |
1352 |
|
1392 | |||
1353 | - IPython.core.oinspect.Inspector.pinfo(self, obj, oname='', formatter='None', info='None', detail_level=0, enable_html_pager=True) |
|
1393 | - IPython.core.oinspect.Inspector.pinfo(self, obj, oname='', formatter='None', info='None', detail_level=0, enable_html_pager=True) | |
1354 | + IPython.core.oinspect.Inspector.pinfo(self, obj, oname='', formatter='None', info='None', detail_level=0, enable_html_pager=True, omit_sections='()') |
|
1394 | + IPython.core.oinspect.Inspector.pinfo(self, obj, oname='', formatter='None', info='None', detail_level=0, enable_html_pager=True, omit_sections='()') | |
1355 |
|
1395 | |||
1356 | - IPython.core.profiledir.ProfileDir.copy_config_file(self, config_file, path='None', overwrite=False) |
|
1396 | - IPython.core.profiledir.ProfileDir.copy_config_file(self, config_file, path='None', overwrite=False) | |
1357 | + IPython.core.profiledir.ProfileDir.copy_config_file(self, config_file, path, overwrite=False) |
|
1397 | + IPython.core.profiledir.ProfileDir.copy_config_file(self, config_file, path, overwrite=False) | |
1358 |
|
1398 | |||
1359 | - IPython.core.ultratb.VerboseTB.format_record(self, frame, file, lnum, func, lines, index) |
|
1399 | - IPython.core.ultratb.VerboseTB.format_record(self, frame, file, lnum, func, lines, index) | |
1360 | + IPython.core.ultratb.VerboseTB.format_record(self, frame_info) |
|
1400 | + IPython.core.ultratb.VerboseTB.format_record(self, frame_info) | |
1361 |
|
1401 | |||
1362 | - IPython.terminal.embed.InteractiveShellEmbed.mainloop(self, local_ns='None', module='None', stack_depth=0, display_banner='None', global_ns='None', compile_flags='None') |
|
1402 | - IPython.terminal.embed.InteractiveShellEmbed.mainloop(self, local_ns='None', module='None', stack_depth=0, display_banner='None', global_ns='None', compile_flags='None') | |
1363 | + IPython.terminal.embed.InteractiveShellEmbed.mainloop(self, local_ns='None', module='None', stack_depth=0, compile_flags='None') |
|
1403 | + IPython.terminal.embed.InteractiveShellEmbed.mainloop(self, local_ns='None', module='None', stack_depth=0, compile_flags='None') | |
1364 |
|
1404 | |||
1365 | - IPython.terminal.embed.embed(**kwargs) |
|
1405 | - IPython.terminal.embed.embed(**kwargs) | |
1366 | + IPython.terminal.embed.embed(*, header='', compile_flags='None', **kwargs) |
|
1406 | + IPython.terminal.embed.embed(*, header='', compile_flags='None', **kwargs) | |
1367 |
|
1407 | |||
1368 | - IPython.terminal.interactiveshell.TerminalInteractiveShell.interact(self, display_banner='<object object at 0xffffff>') |
|
1408 | - IPython.terminal.interactiveshell.TerminalInteractiveShell.interact(self, display_banner='<object object at 0xffffff>') | |
1369 | + IPython.terminal.interactiveshell.TerminalInteractiveShell.interact(self) |
|
1409 | + IPython.terminal.interactiveshell.TerminalInteractiveShell.interact(self) | |
1370 |
|
1410 | |||
1371 | - IPython.terminal.interactiveshell.TerminalInteractiveShell.mainloop(self, display_banner='<object object at 0xffffff>') |
|
1411 | - IPython.terminal.interactiveshell.TerminalInteractiveShell.mainloop(self, display_banner='<object object at 0xffffff>') | |
1372 | + IPython.terminal.interactiveshell.TerminalInteractiveShell.mainloop(self) |
|
1412 | + IPython.terminal.interactiveshell.TerminalInteractiveShell.mainloop(self) | |
1373 |
|
1413 | |||
1374 | - IPython.utils.path.get_py_filename(name, force_win32='None') |
|
1414 | - IPython.utils.path.get_py_filename(name, force_win32='None') | |
1375 | + IPython.utils.path.get_py_filename(name) |
|
1415 | + IPython.utils.path.get_py_filename(name) | |
1376 |
|
1416 | |||
1377 | The following are new attributes (that might be inherited):: |
|
1417 | The following are new attributes (that might be inherited):: | |
1378 |
|
1418 | |||
1379 | + IPython.core.completer.IPCompleter.unicode_names |
|
1419 | + IPython.core.completer.IPCompleter.unicode_names | |
1380 | + IPython.core.debugger.InterruptiblePdb.precmd |
|
1420 | + IPython.core.debugger.InterruptiblePdb.precmd | |
1381 | + IPython.core.debugger.Pdb.precmd |
|
1421 | + IPython.core.debugger.Pdb.precmd | |
1382 | + IPython.core.ultratb.AutoFormattedTB.has_colors |
|
1422 | + IPython.core.ultratb.AutoFormattedTB.has_colors | |
1383 | + IPython.core.ultratb.ColorTB.has_colors |
|
1423 | + IPython.core.ultratb.ColorTB.has_colors | |
1384 | + IPython.core.ultratb.FormattedTB.has_colors |
|
1424 | + IPython.core.ultratb.FormattedTB.has_colors | |
1385 | + IPython.core.ultratb.ListTB.has_colors |
|
1425 | + IPython.core.ultratb.ListTB.has_colors | |
1386 | + IPython.core.ultratb.SyntaxTB.has_colors |
|
1426 | + IPython.core.ultratb.SyntaxTB.has_colors | |
1387 | + IPython.core.ultratb.TBTools.has_colors |
|
1427 | + IPython.core.ultratb.TBTools.has_colors | |
1388 | + IPython.core.ultratb.VerboseTB.has_colors |
|
1428 | + IPython.core.ultratb.VerboseTB.has_colors | |
1389 | + IPython.terminal.debugger.TerminalPdb.do_interact |
|
1429 | + IPython.terminal.debugger.TerminalPdb.do_interact | |
1390 | + IPython.terminal.debugger.TerminalPdb.precmd |
|
1430 | + IPython.terminal.debugger.TerminalPdb.precmd | |
1391 |
|
1431 | |||
1392 | The following attribute/methods have been removed:: |
|
1432 | The following attribute/methods have been removed:: | |
1393 |
|
1433 | |||
1394 | - IPython.core.application.BaseIPythonApplication.deprecated_subcommands |
|
1434 | - IPython.core.application.BaseIPythonApplication.deprecated_subcommands | |
1395 | - IPython.core.ultratb.AutoFormattedTB.format_records |
|
1435 | - IPython.core.ultratb.AutoFormattedTB.format_records | |
1396 | - IPython.core.ultratb.ColorTB.format_records |
|
1436 | - IPython.core.ultratb.ColorTB.format_records | |
1397 | - IPython.core.ultratb.FormattedTB.format_records |
|
1437 | - IPython.core.ultratb.FormattedTB.format_records | |
1398 | - IPython.terminal.embed.InteractiveShellEmbed.init_deprecation_warnings |
|
1438 | - IPython.terminal.embed.InteractiveShellEmbed.init_deprecation_warnings | |
1399 | - IPython.terminal.embed.InteractiveShellEmbed.init_readline |
|
1439 | - IPython.terminal.embed.InteractiveShellEmbed.init_readline | |
1400 | - IPython.terminal.embed.InteractiveShellEmbed.write |
|
1440 | - IPython.terminal.embed.InteractiveShellEmbed.write | |
1401 | - IPython.terminal.embed.InteractiveShellEmbed.write_err |
|
1441 | - IPython.terminal.embed.InteractiveShellEmbed.write_err | |
1402 | - IPython.terminal.interactiveshell.TerminalInteractiveShell.init_deprecation_warnings |
|
1442 | - IPython.terminal.interactiveshell.TerminalInteractiveShell.init_deprecation_warnings | |
1403 | - IPython.terminal.interactiveshell.TerminalInteractiveShell.init_readline |
|
1443 | - IPython.terminal.interactiveshell.TerminalInteractiveShell.init_readline | |
1404 | - IPython.terminal.interactiveshell.TerminalInteractiveShell.write |
|
1444 | - IPython.terminal.interactiveshell.TerminalInteractiveShell.write | |
1405 | - IPython.terminal.interactiveshell.TerminalInteractiveShell.write_err |
|
1445 | - IPython.terminal.interactiveshell.TerminalInteractiveShell.write_err | |
1406 | - IPython.terminal.ipapp.LocateIPythonApp.deprecated_subcommands |
|
1446 | - IPython.terminal.ipapp.LocateIPythonApp.deprecated_subcommands | |
1407 | - IPython.terminal.ipapp.LocateIPythonApp.initialize_subcommand |
|
1447 | - IPython.terminal.ipapp.LocateIPythonApp.initialize_subcommand | |
1408 | - IPython.terminal.ipapp.TerminalIPythonApp.deprecated_subcommands |
|
1448 | - IPython.terminal.ipapp.TerminalIPythonApp.deprecated_subcommands | |
1409 | - IPython.terminal.ipapp.TerminalIPythonApp.initialize_subcommand |
|
1449 | - IPython.terminal.ipapp.TerminalIPythonApp.initialize_subcommand |
General Comments 0
You need to be logged in to leave comments.
Login now