IPython Documentation

Table Of Contents

Previous topic


Next topic

Module: config.configurable

This Page


This documentation is for an old version of IPython. You can find docs for newer versions here.

Module: config.application

A base class for a configurable application.


  • Brian Granger
  • Min RK

3 Classes

class IPython.config.application.ApplicationError

Bases: exceptions.Exception

class IPython.config.application.LevelFormatter(fmt=None, datefmt=None)

Bases: logging.Formatter

Formatter with additional highlevel record

This field is empty if log level is less than highlevel_limit, otherwise it is formatted with self.highlevel_format.

Useful for adding ‘WARNING’ to warning messages, without adding ‘INFO’ to info, etc.

class IPython.config.application.Application(**kwargs)

Bases: IPython.config.configurable.SingletonConfigurable

A singleton application with full configuration support.


flatten flags and aliases, so cl-args override as expected.

This prevents issues such as an alias pointing to InteractiveShell, but a config file setting the same trait in TerminalInteraciveShell getting inappropriate priority over the command-line arg.

Only aliases with exactly one descendent in the class list will be promoted.


generate default config file from Configurables


Do the basic steps to configure me.

Override in subclasses.

initialize_subcommand(subc, argv=None)

Initialize a subcommand with argv.

classmethod launch_instance(argv=None, **kwargs)

Launch a global instance of this Application

If a global instance already exists, this reinitializes and starts it

load_config_file(filename, path=None)

Load a .py based config file by filename and path.


Parse the command line arguments.


Print the alias part of the help.


Print the application description.


Print usage and examples.

This usage string goes at the end of the command line help string and should contain examples of the application’s usage.


Print the flag part of the help.


Print the help for each Configurable class in self.classes.

If classes=False (the default), only flags and aliases are printed.


Print the subcommand part of the help.


Print the version string.


Start the app mainloop.

Override in subclasses.


Fire the traits events when the config is updated.

2 Functions


Method decorator for catching invalid config (Trait/ArgumentErrors) during init.

On a TraitError (generally caused by bad config), this will print the trait’s message, and exit the app.

For use on init methods, to prevent invoking excepthook on invalid input.

IPython.config.application.boolean_flag(name, configurable, set_help='', unset_help='')

Helper for building basic –trait, –no-trait flags.


name : str

The name of the flag.

configurable : str

The ‘Class.trait’ string of the trait to be set/unset with the flag

set_help : unicode

help string for –name flag

unset_help : unicode

help string for –no-name flag


cfg : dict

A dict with two keys: ‘name’, and ‘no-name’, for setting and unsetting the trait, respectively.