Show More
@@ -96,10 +96,48 b' features contributed by QuantStack (with respect to debugger protocol, and Xeus' | |||
|
96 | 96 | Python), as well as many debugger features that I was please to implement as |
|
97 | 97 | part of my work at QuanSight and Sponsored by DE Shaw. |
|
98 | 98 | |
|
99 | Better Tracebacks | |
|
100 | ~~~~~~~~~~~~~~~~~ | |
|
99 | Traceback improvements | |
|
100 | ~~~~~~~~~~~~~~~~~~~~~~ | |
|
101 | ||
|
102 | Previously, error tracebacks for errors happening in code cells were showing a | |
|
103 | hash, the one used for compiling the Python AST:: | |
|
101 | 104 |
|
|
102 | The first on is the integration of the ``stack_data`` package; | |
|
105 | In [1]: def foo(): | |
|
106 | ...: return 3 / 0 | |
|
107 | ...: | |
|
108 | ||
|
109 | In [2]: foo() | |
|
110 | --------------------------------------------------------------------------- | |
|
111 | ZeroDivisionError Traceback (most recent call last) | |
|
112 | <ipython-input-2-c19b6d9633cf> in <module> | |
|
113 | ----> 1 foo() | |
|
114 | ||
|
115 | <ipython-input-1-1595a74c32d5> in foo() | |
|
116 | 1 def foo(): | |
|
117 | ----> 2 return 3 / 0 | |
|
118 | 3 | |
|
119 | ||
|
120 | ZeroDivisionError: division by zero | |
|
121 | ||
|
122 | The error traceback is now correctly formatted, showing the cell number in which the error happened:: | |
|
123 | ||
|
124 | In [1]: def foo(): | |
|
125 | ...: return 3 / 0 | |
|
126 | ...: | |
|
127 | ||
|
128 | Input In [2]: foo() | |
|
129 | --------------------------------------------------------------------------- | |
|
130 | ZeroDivisionError Traceback (most recent call last) | |
|
131 | input In [2], in <module> | |
|
132 | ----> 1 foo() | |
|
133 | ||
|
134 | Input In [1], in foo() | |
|
135 | 1 def foo(): | |
|
136 | ----> 2 return 3 / 0 | |
|
137 | ||
|
138 | ZeroDivisionError: division by zero | |
|
139 | ||
|
140 | The Second on is the integration of the ``stack_data`` package; | |
|
103 | 141 | which provide smarter informations in traceback; in particular it will highlight |
|
104 | 142 | the AST node where an error occurs which can help to quickly narrow down errors. |
|
105 | 143 | |
@@ -143,6 +181,24 b' IPython 8.0 is capable of telling you, where the index error occurs::' | |||
|
143 | 181 | Corresponding location marked here with ``^`` will show up highlighted in |
|
144 | 182 | terminal and notebooks. |
|
145 | 183 | |
|
184 | The Third, which is the most discreet but can have a high impact on | |
|
185 | productivity, a colon ``::`` and line number is appended after a filename in | |
|
186 | traceback:: | |
|
187 | ||
|
188 | ||
|
189 | ZeroDivisionError Traceback (most recent call last) | |
|
190 | File ~/error.py:4, in <module> | |
|
191 | 1 def f(): | |
|
192 | 2 1/0 | |
|
193 | ----> 4 f() | |
|
194 | ||
|
195 | File ~/error.py:2, in f() | |
|
196 | 1 def f(): | |
|
197 | ----> 2 1/0 | |
|
198 | ||
|
199 | Many terminal and editor have integrations allow to directly jump to the | |
|
200 | relevant file/line when this syntax is used. | |
|
201 | ||
|
146 | 202 | |
|
147 | 203 | Autosuggestons |
|
148 | 204 | ~~~~~~~~~~~~~~ |
@@ -246,7 +302,14 b' Try ``%autoreload 3`` in an IPython session after running ``%load_ext autoreload' | |||
|
246 | 302 | |
|
247 | 303 | For more information please see the following unit test : ``extensions/tests/test_autoreload.py:test_autoload_newly_added_objects`` |
|
248 | 304 | |
|
305 | Auto formatting with black in the CLI | |
|
306 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
|
307 | ||
|
308 | If ``black`` is installed in the same environment as IPython, terminal IPython | |
|
309 | will now *by default* reformat the code in the CLI when possible. You can | |
|
310 | disable this with ``--TerminalInteractiveShell.autoformatter=None``. | |
|
249 | 311 | |
|
312 | This feature was present in 7.x but disabled by default. | |
|
250 | 313 | |
|
251 | 314 | |
|
252 | 315 | History Range Glob feature |
@@ -333,53 +396,29 b' included).' | |||
|
333 | 396 | |
|
334 | 397 | Therefore it is now possible to save the whole history to a file using simple |
|
335 | 398 | ``%save <filename>``, load and edit it using ``%load`` (makes for a nice usage |
|
336 |
when followed with :kbd:`F2`), send it to dpaste.org |
|
|
337 |
|
|
|
399 | when followed with :kbd:`F2`), send it to `dpaste.org <http://dpast.org>`_ using | |
|
400 | ``%pastebin``, or view the whole thing syntax-highlighted with a single | |
|
401 | ``%pycat``. | |
|
338 | 402 | |
|
339 | Traceback improvements | |
|
340 | ~~~~~~~~~~~~~~~~~~~~~~ | |
|
341 | 403 | |
|
404 | Windows time-implementation: Switch to process_time | |
|
405 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
|
406 | Timing for example with ``%%time`` on windows is based on ``time.perf_counter``. | |
|
407 | This is at the end the same as W-All. | |
|
408 | To be a bit tighter to linux one could change to ``time.process_time`` instead. | |
|
409 | Thus for example one would no longer count periods of sleep and further. | |
|
342 | 410 | |
|
343 | Previously, error tracebacks for errors happening in code cells were showing a hash, the one used for compiling the Python AST:: | |
|
344 | ||
|
345 | In [1]: def foo(): | |
|
346 | ...: return 3 / 0 | |
|
347 | ...: | |
|
348 | ||
|
349 | In [2]: foo() | |
|
350 | --------------------------------------------------------------------------- | |
|
351 | ZeroDivisionError Traceback (most recent call last) | |
|
352 | <ipython-input-2-c19b6d9633cf> in <module> | |
|
353 | ----> 1 foo() | |
|
354 | ||
|
355 | <ipython-input-1-1595a74c32d5> in foo() | |
|
356 | 1 def foo(): | |
|
357 | ----> 2 return 3 / 0 | |
|
358 | 3 | |
|
359 | ||
|
360 | ZeroDivisionError: division by zero | |
|
361 | ||
|
362 | The error traceback is now correctly formatted, showing the cell number in which the error happened:: | |
|
363 | ||
|
364 | In [1]: def foo(): | |
|
365 | ...: return 3 / 0 | |
|
366 | ...: | |
|
367 | ||
|
368 | Input In [2]: foo() | |
|
369 | --------------------------------------------------------------------------- | |
|
370 | ZeroDivisionError Traceback (most recent call last) | |
|
371 | input In [2], in <module> | |
|
372 | ----> 1 foo() | |
|
373 | ||
|
374 | Input In [1], in foo() | |
|
375 | 1 def foo(): | |
|
376 | ----> 2 return 3 / 0 | |
|
377 | ||
|
378 | ZeroDivisionError: division by zero | |
|
379 | 411 | |
|
380 | 412 | Miscellaneous |
|
381 | 413 | ~~~~~~~~~~~~~ |
|
382 | ||
|
414 | - Non-text formatters are not disabled in terminal which should simplify | |
|
415 | writing extension displaying images or other mimetypes supporting terminals. | |
|
416 | :ghpull:`12315` | |
|
417 | - | |
|
418 | - It is now possible to automatically insert matching brackets in Terminal IPython using the | |
|
419 | ``TerminalInteractiveShell.auto_match=True`` option. :ghpull:`12586` | |
|
420 | - We are thinking of deprecating the current ``%%javascript`` magic in favor of a better replacement. See :ghpull:`13376` | |
|
421 | - ``%time`` uses ``process_time`` instead of ``perf_counter``, see :ghpull:`12984` | |
|
383 | 422 | - ``~`` is now expanded when part of a path in most magics :ghpull:`13385` |
|
384 | 423 | - ``%/%%timeit`` magic now adds comma every thousands to make reading long number easier :ghpull:`13379` |
|
385 | 424 | - ``"info"`` messages can now be customised to hide some fields :ghpull:`13343` |
@@ -390,7 +429,15 b' Miscellaneous' | |||
|
390 | 429 | now warn users if they use it. :ghpull:`12954` |
|
391 | 430 | - make ``%precision`` work for ``numpy.float64`` type :ghpull:`12902` |
|
392 | 431 | |
|
432 | Re-added support for XDG config directories | |
|
433 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
|
393 | 434 | |
|
435 | XDG support through the years did come an go, there is a tension between having | |
|
436 | identical location in all platforms to have simple instructions. After initial | |
|
437 | failure a couple of years ago IPython was modified to automatically migrate XDG | |
|
438 | config files back into ``~/.ipython``, the migration code has now been removed. | |
|
439 | And IPython now check the XDG locations, so if you _manually_ move your config | |
|
440 | files to your preferred location, IPython will not move them back. | |
|
394 | 441 | |
|
395 | 442 | |
|
396 | 443 | Numfocus Small Developer Grant |
General Comments 0
You need to be logged in to leave comments.
Login now