Module:core.application

An application for IPython.

All top-level applications should use the classes in this module forhandling configuration and creating configurables.

The job of anApplication is to create the master configurationobject and then create the configurable objects, passing the config to them.

2 Classes

classIPython.core.application.ProfileAwareConfigLoader(filename:str,path:str|None=None,**kw:Any)

Bases:PyFileConfigLoader

A Python file config loader that is aware of IPython profiles.

load_subconfig(fname,path=None,profile=None)

Injected into config file namespace as load_subconfig

classIPython.core.application.BaseIPythonApplication(**kwargs:Any)

Bases:Application

__init__(**kwargs)

Create a configurable given a config config.

Parameters:
  • config (Config) – If this is empty, default values are used. If config is aConfig instance, it will be used to configure theinstance.

  • parent (Configurable instance,optional) – The parent Configurable instance of this object.

Notes

Subclasses of Configurable must call the__init__() method ofConfigurablebefore doing anything else and usingsuper():

classMyConfigurable(Configurable):def__init__(self,config=None):super(MyConfigurable,self).__init__(config=config)# Then any other code you need to finish initialization.

This ensures that instances will be configured properly.

auto_create

Whether to create profile dir if it doesn’t exist

copy_config_files

Whether to install the default config files into the profile dir.If a new profile is being created, and IPython contains config files for thatprofile, then they will be staged into the new directory. Otherwise,default config files will be automatically generated.

excepthook(etype,evalue,tb)

this is sys.excepthook after init_crashhandler

set self.verbose_crash=True to use our full crashhandler, instead ofa regular traceback with a short message (crash_handler_lite)

extra_config_file

Path to an extra config file to load.

If specified, load this config file in addition to any other IPython config.

init_config_files()

[optionally] copy default config files into profile dir.

init_crash_handler()

Create a crash handler, typically setting sys.excepthook to it.

init_profile_dir()

initialize the profile dir

initialize(argv=None)

Do the basic steps to configure me.

Override in subclasses.

ipython_dir

The name of the IPython directory. This directory is used for loggingconfiguration (through profiles), history storage, etc. The defaultis usually $HOME/.ipython. This option can also be specified throughthe environment variable IPYTHONDIR.

load_config_file(suppress_errors=None)

Load the config file.

By default, errors in loading config are handled, and a warningprinted on screen. For testing, the suppress_errors option is setto False, so errors will make tests fail.

suppress_errors default value is to beNone in which case thebehavior default to the one oftraitlets.Application.

The default value can be set :
  • toFalse by setting ‘IPYTHON_SUPPRESS_CONFIG_ERRORS’ environment variable to ‘0’, or ‘false’ (case insensitive).

  • toTrue by setting ‘IPYTHON_SUPPRESS_CONFIG_ERRORS’ environment variable to ‘1’ or ‘true’ (case insensitive).

  • toNone by setting ‘IPYTHON_SUPPRESS_CONFIG_ERRORS’ environment variable to ‘’ (empty string) or leaving it unset.

Any other value are invalid, and will make IPython exit with a non-zero return code.

overwrite

Whether to overwrite existing config files when copying

profile

The IPython profile to use.

python_config_loader_class

alias ofProfileAwareConfigLoader

stage_default_config_file()

auto generate default config file, and stage it into the profile.

verbose_crash

Create a massive crash report when IPython encounters what may be aninternal error. The default is to append a short message to theusual traceback