- Fix error when starting with
Remarkable changes and fixes:
- restore IPython’s debugger to raise on quit. PR #10009
- The configuration value
c.TerminalInteractiveShell.highlighting_stylecan now directly take a class argument for custom color style. PR #9848
- Correctly handle matplotlib figures dpi PR #9868
-eflag for the
%notebookmagic that had no effects. PR #9872
- You can now press F2 while typing at a terminal prompt to edit the contents
in your favourite terminal editor. Set the
EDITORenvironment variable to pick which editor is used. PR #9929
- sdists will now only be
.tar.gzas per upstream PyPI requirements. PR #9925
IPython.core.debuggerhave gained a
set_trace()method for convenience. PR #9947
- The ‘smart command mode’ added to the debugger in 5.0 was removed, as more
people preferred the previous behaviour. Therefore, debugger commands such as
cwill act as debugger commands even when
cis defined as a variable. PR #10050
- Fixes OS X event loop issues at startup, PR #10150
- Deprecate the
%autoindentmagic. PR #10176
- Emit a
DeprecationWarningwhen setting the deprecated
limit_to_alloption of the completer. PR #10198
Changes of behavior to
InteractiveShellEmbed interactive behavior have changed a bit in between
5.1 and 5.2. By default
%kill_embedded magic will prevent further invocation
of the current
call location instead of preventing further invocation of
the current instance creation location. For most use case this will not change
much for you, though previous behavior was confusing and less consistent with
previous IPython versions.
You can now deactivate instances by using
%kill_embedded --instance flag,
-i in short). The
%kill_embedded magic also gained a
-y option which skip confirmation step, and
which also exit the current embedded call without asking for confirmation.
See PR #10207.
%timeiton Python2 due to the use of
__qualname__. PR #9804
%gui qtto create and return a
QApplicationif necessary. PR #9789
- Don’t set terminal title by default. PR #9801
- Preserve indentation when inserting newlines with
Ctrl-O. PR #9770
- Restore completion in debugger. PR #9785
IPython.core.debugger.Tracer()in favor of simpler, newer, APIs. PR #9731
NoOpContextcontext manager removed by mistake, and add
DeprecationWarning. PR #9765
- Add option allowing
Prompt_toolkitto use 24bits colors. PR #9736
- Fix for closing interactive matplotlib windows on OS X. PR #9854
- An embedded interactive shell instance can be used more than once. PR #9843
- More robust check for whether IPython is in a terminal. PR #9833
- Better pretty-printing of dicts on PyPy. PR #9827
- Some coloured output now looks better on dark background command prompts in Windows. PR #9838
- Improved tab completion of paths on Windows . PR #9826
- Fix tkinter event loop integration on Python 2 with
futureinstalled. PR #9824
Ctrl-\as a shortcut to quit IPython.
get_ipython()accessible when modules are imported by startup files. PR #9818
- Add support for running directories containing a
__main__.pyfile with the
ipythoncommand. PR #9813
True Color feature¶
prompt_toolkit uses pygments styles for syntax highlighting. By default, the
colors specified in the style are approximated using a standard 256-color
prompt_toolkit also supports 24bit, a.k.a. “true”, a.k.a. 16-million
color escape sequences which enable compatible terminals to display the exact
colors specified instead of an approximation. This true_color option exposes
that capability in prompt_toolkit to the IPython shell.
Here is a good source for the current state of true color support in various terminal emulators and software projects: https://gist.github.com/XVilka/8346728
Released July 7, 2016
New terminal interface¶
IPython 5 features a major upgrade to the terminal interface, bringing live syntax highlighting as you type, proper multiline editing and multiline paste, and tab completions that don’t clutter up your history.
These features are provided by the Python library prompt_toolkit, which replaces
readline throughout our terminal interface.
Relying on this pure-Python, cross platform module also makes it simpler to
install IPython. We have removed dependencies on
pyreadline for Windows and
gnureadline for Mac.
Backwards incompatible changes¶
%install_extmagic function, deprecated since 4.0, has now been deleted. You can distribute and install extensions as packages on PyPI.
- Callbacks registered while an event is being handled will now only be called for subsequent events; previously they could be called for the current event. Similarly, callbacks removed while handling an event will always get that event. See #9447 and PR #9453.
- Integration with pydb has been removed since pydb development has been stopped since 2012, and pydb is not installable from PyPI.
autoedit_syntaxoption has apparently been broken for many years. It has been removed.
New terminal interface¶
The overhaul of the terminal interface will probably cause a range of minor issues for existing users. This is inevitable for such a significant change, and we’ve done our best to minimise these issues. Some changes that we’re aware of, with suggestions on how to handle them:
IPython no longer uses readline configuration (
~/.inputrc). We hope that
the functionality you want (e.g. vi input mode) will be available by configuring
IPython directly (see Terminal IPython options).
If something’s missing, please file an issue.
PromptManager class has been removed, and the prompt machinery simplified.
See Custom Prompts to customise prompts with the new machinery.
There are new options to configure the colours used in syntax highlighting.
We have tried to integrate them with our classic
--colors option and
%colors magic, but there’s a mismatch in possibilities, so some configurations
may produce unexpected results. See Terminal Colors for more information.
The new interface is not compatible with Emacs ‘inferior-shell’ feature. To
continue using this, add the
--simple-prompt flag to the command Emacs
runs. This flag disables most IPython features, relying on Emacs to provide
things like tab completion.
Provisional changes are experimental functionality that may, or may not, make it into a future version of IPython, and which API may change without warnings. Activating these features and using these API are at your own risk, and may have security implication for your system, especially if used with the Jupyter notebook,
When running via the Jupyter notebook interfaces, or other compatible client, you can enable rich documentation experimental functionality:
docrepr package is installed setting the boolean flag
True, will process the various
object through sphinx before displaying them (see the
documentation for more information.
You need to also enable the IPython pager display rich HTML representation
InteractiveShell.enable_html_pager boolean configuration option.
As usual you can set these configuration options globally in your configuration
files, alternatively you can turn them on dynamically using the following
ip = get_ipython() ip.sphinxify_docstring = True ip.enable_html_pager = True
You can test the effect of various combinations of the above configuration in the Jupyter notebook, with things example like :
import numpy as np np.histogram?
This is part of an effort to make Documentation in Python richer and provide in the long term if possible dynamic examples that can contain math, images, widgets... As stated above this is nightly experimental feature with a lot of (fun) problem to solve. We would be happy to get your feedback and expertise on it.
Some deprecated features are listed in this section. Don’t forget to enable
DeprecationWarning as an error if you are using IPython in a Continuous
Integration setup or in your testing in general:
import warnings warnings.filterwarnings('error', '.*', DeprecationWarning, module='yourmodule.*')
hooks.fix_error_editorseems unused and is pending deprecation.
IPython.core.InteractiveShell:write()is deprecated; use
IPython.core.InteractiveShell:write_err()is deprecated; use
formatterkeyword argument to
IPython.core.oinspechas no effect.
global_nskeyword argument of IPython Embed was deprecated, and has no effect. Use
modulekeyword argument instead.
<Esc>Key does not dismiss the completer and does not clear the current buffer. This is an on purpose modification due to current technical limitation. Cf PR #9572. Escape the control character which is used for other shortcut, and there is no practical way to distinguish. Use Ctr-G or Ctrl-C as an alternative.
- Cannot use
Ctrl-Enterto submit code in terminal. cf #9587 and #9401. In terminal there is no practical way to distinguish these key sequences from a normal new line return.
pageDowndo not move through completion menu.
- Color styles might not adapt to terminal emulator themes. This will need new version of Pygments to be released, and can be mitigated with custom themes.