Important

This documentation covers IPython versions 6.0 and higher. Beginning with version 6.0, IPython stopped supporting compatibility with Python versions lower than 3.3 including all versions of Python 2.7.

If you are looking for an IPython version compatible with Python 2.7, please use the IPython 5.x LTS release and refer to its documentation (LTS is the long term support release).

Module: core.shellapp

A mixin for Application classes that launch InteractiveShell instances, load extensions, etc.

2 Classes

class IPython.core.shellapp.MatplotlibBackendCaselessStrEnum(default_value: Any = traitlets.Undefined, **kwargs: Any)

Bases: CaselessStrEnum

An enum of Matplotlib backend strings where the case should be ignored.

Prior to Matplotlib 3.9.0 the list of valid backends is hardcoded in pylabtools.backends. After that, Matplotlib manages backends.

The list of valid backends is determined when it is first needed to avoid wasting unnecessary initialisation time.

__init__(default_value: Any = traitlets.Undefined, **kwargs: Any) None

Declare a traitlet.

If allow_none is True, None is a valid value in addition to any values that are normally valid. The default is up to the subclass. For most trait types, the default value for allow_none is False.

If read_only is True, attempts to directly modify a trait attribute raises a TraitError.

If help is a string, it documents the attribute’s purpose.

Extra metadata can be associated with the traitlet using the .tag() convenience method or by using the traitlet instance’s .metadata dictionary.

class IPython.core.shellapp.InteractiveShellApp(**kwargs: Any)

Bases: Configurable

A Mixin for applications that start InteractiveShell instances.

Provides configurables for loading extensions and executing files as part of configuring a Shell environment.

The following methods should be called by the initialize() method of the subclass:

code_to_run

Execute the given command string.

exec_PYTHONSTARTUP

Run the file referenced by the PYTHONSTARTUP environment variable at IPython startup.

exec_files

List of files to run at IPython startup.

exec_lines

lines of code to run at IPython startup.

extensions

A list of dotted module names of IPython extensions to load.

extra_extensions

Dotted module name(s) of one or more IPython extensions to load.

For specifying extra extensions to load on the command-line.

Added in version 7.10.

file_to_run

A file to be run

gui

Enable GUI event loop integration with any of (‘asyncio’, ‘glut’, ‘gtk’, ‘gtk2’, ‘gtk3’, ‘gtk4’, ‘osx’, ‘pyglet’, ‘qt’, ‘qt5’, ‘qt6’, ‘tk’, ‘wx’, ‘gtk2’, ‘qt4’).

hide_initial_ns

Should variables loaded at startup (by startup files, exec_lines, etc.) be hidden from tools like %who?

ignore_cwd

If True, IPython will not add the current working directory to sys.path. When False, the current working directory is added to sys.path, allowing imports of modules defined in the current directory.

init_code()

run the pre-flight code, specified via exec_lines

init_extensions()

Load all IPython extensions in IPythonApp.extensions.

This uses the ExtensionManager.load_extensions() to load all the extensions listed in self.extensions.

init_gui_pylab()

Enable GUI event loop integration, taking pylab into account.

init_path()

Add current working directory, ‘’, to sys.path

Unlike Python’s default, we insert before the first site-packages or dist-packages directory, so that it is after the standard library.

Changed in version 7.2: Try to insert after the standard library, instead of first.

Changed in version 8.0: Allow optionally not including the current directory in sys.path

matplotlib

Configure matplotlib for interactive use with the default matplotlib backend. The exact options available depend on what Matplotlib provides at runtime.

module_to_run

Run the module as a script.

pylab

Pre-load matplotlib and numpy for interactive use, selecting a particular matplotlib backend and loop integration. The exact options available depend on what Matplotlib provides at runtime.

pylab_import_all

If true, IPython will populate the user namespace with numpy, pylab, etc. and an import * is done from numpy and pylab, when using pylab mode.

When False, pylab mode should not import any names into the user namespace.

reraise_ipython_extension_failures

Reraise exceptions encountered loading IPython extensions?