IPython Documentation

Table Of Contents

Previous topic

core.prefilter

Next topic

core.profiledir

This Page

core.profileapp

Module: core.profileapp

Inheritance diagram for IPython.core.profileapp:

An application for managing IPython profiles.

To be invoked as the ipython profile subcommand.

Authors:

  • Min RK

Classes

ProfileApp

class IPython.core.profileapp.ProfileApp(**kwargs)

Bases: IPython.config.application.Application

__init__(**kwargs)
aliases

An instance of a Python dict.

classmethod class_config_section()

Get the config class config section

classmethod class_get_help()

Get the help string for this class in ReST format.

classmethod class_get_trait_help(trait)

Get the help string for a single trait.

classmethod class_print_help()

Get the help string for a single trait and print it.

classmethod class_trait_names(**metadata)

Get a list of all the names of this classes traits.

This method is just like the trait_names() method, but is unbound.

classmethod class_traits(**metadata)

Get a list of all the traits of this class.

This method is just like the traits() method, but is unbound.

The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.

This follows the same algorithm as traits does and does not allow for any simple way of specifying merely that a metadata name exists, but has any value. This is because get_metadata returns None if a metadata key doesn’t exist.

classes

An instance of a Python list.

classmethod clear_instance()

unset _instance for this class and singleton parents.

config

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

created = None
description = "Manage IPython profiles\n\nProfile directories contain\nconfiguration, log and security related files and are named\nusing the convention 'profile_<name>'. By default they are\nlocated in your ipython directory. You can create profiles\nwith `ipython profile create <name>`, or see the profiles you\nalready have with `ipython profile list`\n\nTo get started configuring IPython, simply do:\n\n$> ipython profile create\n\nand IPython will create the default profile in <ipython_dir>/profile_default,\nwhere you can edit ipython_config.py to start configuring IPython.\n\n"
examples = '\nipython profile create -h # show the help string for the create subcommand\nipython profile list -h # show the help string for the list subcommand\n'
exit(exit_status=0)
extra_args

An instance of a Python list.

flags

An instance of a Python dict.

generate_config_file()

generate default config file from Configurables

init_logging()

Start logging for this application.

The default is to log to stdout using a StreaHandler. The log level starts at loggin.WARN, but this can be adjusted by setting the log_level attribute.

initialize(argv=None)

Do the basic steps to configure me.

Override in subclasses.

initialize_subcommand(subc, argv=None)

Initialize a subcommand with argv.

classmethod initialized()

Has an instance been created?

classmethod instance(*args, **kwargs)

Returns a global instance of this class.

This method create a new instance if none have previously been created and returns a previously created instance is one already exists.

The arguments and keyword arguments passed to this method are passed on to the __init__() method of the class upon instantiation.

Examples

Create a singleton class using instance, and retrieve it:

>>> from IPython.config.configurable import SingletonConfigurable
>>> class Foo(SingletonConfigurable): pass
>>> foo = Foo.instance()
>>> foo == Foo.instance()
True

Create a subclass that is retrived using the base class instance:

>>> class Bar(SingletonConfigurable): pass
>>> class Bam(Bar): pass
>>> bam = Bam.instance()
>>> bam == Bar.instance()
True
keyvalue_description

A trait for unicode strings.

load_config_file(filename, path=None)

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

log_level

An enum that whose value must be in a given sequence.

name = u'ipython-profile'
on_trait_change(handler, name=None, remove=False)

Setup a handler to be called when a trait changes.

This is used to setup dynamic notifications of trait changes.

Static handlers can be created by creating methods on a HasTraits subclass with the naming convention ‘_[traitname]_changed’. Thus, to create static handler for the trait ‘a’, create the method _a_changed(self, name, old, new) (fewer arguments can be used, see below).

Parameters :

handler : callable

A callable that is called when a trait changes. Its signature can be handler(), handler(name), handler(name, new) or handler(name, old, new).

name : list, str, None

If None, the handler will apply to all traits. If a list of str, handler will apply to all names in the list. If a str, the handler will apply just to that name.

remove : bool

If False (the default), then install the handler. If True then unintall it.

option_description

A trait for unicode strings.

parse_command_line(argv=None)

Parse the command line arguments.

print_alias_help()

Print the alias part of the help.

print_description()

Print the application description.

print_examples()

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_flag_help()

Print the flag part of the help.

print_help(classes=False)

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

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

print_options()
print_subcommands()

Print the subcommand part of the help.

print_version()

Print the version string.

start()
subapp

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

subcommand_description

A trait for unicode strings.

subcommands

An instance of a Python dict.

trait_metadata(traitname, key)

Get metadata values for trait by key.

trait_names(**metadata)

Get a list of all the names of this classes traits.

traits(**metadata)

Get a list of all the traits of this class.

The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.

This follows the same algorithm as traits does and does not allow for any simple way of specifying merely that a metadata name exists, but has any value. This is because get_metadata returns None if a metadata key doesn’t exist.

update_config(config)

Fire the traits events when the config is updated.

version

A trait for unicode strings.

ProfileCreate

class IPython.core.profileapp.ProfileCreate(**kwargs)

Bases: IPython.core.application.BaseIPythonApplication

__init__(**kwargs)
aliases

An instance of a Python dict.

auto_create

A boolean (True, False) trait.

builtin_profile_dir

A trait for unicode strings.

classmethod class_config_section()

Get the config class config section

classmethod class_get_help()

Get the help string for this class in ReST format.

classmethod class_get_trait_help(trait)

Get the help string for a single trait.

classmethod class_print_help()

Get the help string for a single trait and print it.

classmethod class_trait_names(**metadata)

Get a list of all the names of this classes traits.

This method is just like the trait_names() method, but is unbound.

classmethod class_traits(**metadata)

Get a list of all the traits of this class.

This method is just like the traits() method, but is unbound.

The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.

This follows the same algorithm as traits does and does not allow for any simple way of specifying merely that a metadata name exists, but has any value. This is because get_metadata returns None if a metadata key doesn’t exist.

classes = [<class 'IPython.core.profiledir.ProfileDir'>]
classmethod clear_instance()

unset _instance for this class and singleton parents.

config

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

config_file_name

A trait for unicode strings.

config_file_paths

An instance of a Python list.

config_file_specified

A boolean (True, False) trait.

config_files

An instance of a Python list.

copy_config_files

A boolean (True, False) trait.

crash_handler_class

A trait whose value must be a subclass of a specified class.

created = None
description = "Create an IPython profile by name\n\nCreate an ipython profile directory by its name or\nprofile directory path. Profile directories contain\nconfiguration, log and security related files and are named\nusing the convention 'profile_<name>'. By default they are\nlocated in your ipython directory. Once created, you will\ncan edit the configuration files in the profile\ndirectory to configure IPython. Most users will create a\nprofile directory by name,\n`ipython profile create myprofile`, which will put the directory\nin `<ipython_dir>/profile_myprofile`.\n"
examples = '\nipython profile create foo # create profile foo w/ default config files\nipython profile create foo --reset # restage default config files over current\nipython profile create foo --parallel # also stage parallel config files\n'
exit(exit_status=0)
extra_args

An instance of a Python list.

flags

An instance of a Python dict.

generate_config_file()

generate default config file from Configurables

init_config_files()
init_crash_handler()

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

init_logging()

Start logging for this application.

The default is to log to stdout using a StreaHandler. The log level starts at loggin.WARN, but this can be adjusted by setting the log_level attribute.

init_profile_dir()

initialize the profile dir

initialize(argv=None)
initialize_subcommand(subc, argv=None)

Initialize a subcommand with argv.

classmethod initialized()

Has an instance been created?

classmethod instance(*args, **kwargs)

Returns a global instance of this class.

This method create a new instance if none have previously been created and returns a previously created instance is one already exists.

The arguments and keyword arguments passed to this method are passed on to the __init__() method of the class upon instantiation.

Examples

Create a singleton class using instance, and retrieve it:

>>> from IPython.config.configurable import SingletonConfigurable
>>> class Foo(SingletonConfigurable): pass
>>> foo = Foo.instance()
>>> foo == Foo.instance()
True

Create a subclass that is retrived using the base class instance:

>>> class Bar(SingletonConfigurable): pass
>>> class Bam(Bar): pass
>>> bam = Bam.instance()
>>> bam == Bar.instance()
True
ipython_dir

A trait for unicode strings.

keyvalue_description

A trait for unicode strings.

load_config_file(suppress_errors=True)

Load the config file.

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

log_level

An enum that whose value must be in a given sequence.

name = u'ipython-profile'
on_trait_change(handler, name=None, remove=False)

Setup a handler to be called when a trait changes.

This is used to setup dynamic notifications of trait changes.

Static handlers can be created by creating methods on a HasTraits subclass with the naming convention ‘_[traitname]_changed’. Thus, to create static handler for the trait ‘a’, create the method _a_changed(self, name, old, new) (fewer arguments can be used, see below).

Parameters :

handler : callable

A callable that is called when a trait changes. Its signature can be handler(), handler(name), handler(name, new) or handler(name, old, new).

name : list, str, None

If None, the handler will apply to all traits. If a list of str, handler will apply to all names in the list. If a str, the handler will apply just to that name.

remove : bool

If False (the default), then install the handler. If True then unintall it.

option_description

A trait for unicode strings.

overwrite

A boolean (True, False) trait.

parallel

A boolean (True, False) trait.

parse_command_line(argv)
print_alias_help()

Print the alias part of the help.

print_description()

Print the application description.

print_examples()

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_flag_help()

Print the flag part of the help.

print_help(classes=False)

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

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

print_options()
print_subcommands()

Print the subcommand part of the help.

print_version()

Print the version string.

profile

A trait for unicode strings.

stage_default_config_file()
start()

Start the app mainloop.

Override in subclasses.

subapp

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

subcommand_description

A trait for unicode strings.

subcommands

An instance of a Python dict.

trait_metadata(traitname, key)

Get metadata values for trait by key.

trait_names(**metadata)

Get a list of all the names of this classes traits.

traits(**metadata)

Get a list of all the traits of this class.

The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.

This follows the same algorithm as traits does and does not allow for any simple way of specifying merely that a metadata name exists, but has any value. This is because get_metadata returns None if a metadata key doesn’t exist.

update_config(config)

Fire the traits events when the config is updated.

version

A trait for unicode strings.

ProfileList

class IPython.core.profileapp.ProfileList(**kwargs)

Bases: IPython.config.application.Application

__init__(**kwargs)
aliases

An instance of a Python dict.

classmethod class_config_section()

Get the config class config section

classmethod class_get_help()

Get the help string for this class in ReST format.

classmethod class_get_trait_help(trait)

Get the help string for a single trait.

classmethod class_print_help()

Get the help string for a single trait and print it.

classmethod class_trait_names(**metadata)

Get a list of all the names of this classes traits.

This method is just like the trait_names() method, but is unbound.

classmethod class_traits(**metadata)

Get a list of all the traits of this class.

This method is just like the traits() method, but is unbound.

The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.

This follows the same algorithm as traits does and does not allow for any simple way of specifying merely that a metadata name exists, but has any value. This is because get_metadata returns None if a metadata key doesn’t exist.

classes

An instance of a Python list.

classmethod clear_instance()

unset _instance for this class and singleton parents.

config

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

created = None
description = "List available IPython profiles\n\nList all available profiles, by profile location, that can\nbe found in the current working directly or in the ipython\ndirectory. Profile directories are named using the convention\n'profile_<profile>'.\n"
examples = 'ipython profile list # list all profiles'
exit(exit_status=0)
extra_args

An instance of a Python list.

flags

An instance of a Python dict.

generate_config_file()

generate default config file from Configurables

init_logging()

Start logging for this application.

The default is to log to stdout using a StreaHandler. The log level starts at loggin.WARN, but this can be adjusted by setting the log_level attribute.

initialize(argv=None)

Do the basic steps to configure me.

Override in subclasses.

initialize_subcommand(subc, argv=None)

Initialize a subcommand with argv.

classmethod initialized()

Has an instance been created?

classmethod instance(*args, **kwargs)

Returns a global instance of this class.

This method create a new instance if none have previously been created and returns a previously created instance is one already exists.

The arguments and keyword arguments passed to this method are passed on to the __init__() method of the class upon instantiation.

Examples

Create a singleton class using instance, and retrieve it:

>>> from IPython.config.configurable import SingletonConfigurable
>>> class Foo(SingletonConfigurable): pass
>>> foo = Foo.instance()
>>> foo == Foo.instance()
True

Create a subclass that is retrived using the base class instance:

>>> class Bar(SingletonConfigurable): pass
>>> class Bam(Bar): pass
>>> bam = Bam.instance()
>>> bam == Bar.instance()
True
ipython_dir

A trait for unicode strings.

keyvalue_description

A trait for unicode strings.

list_profile_dirs()
load_config_file(filename, path=None)

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

log_level

An enum that whose value must be in a given sequence.

name = u'ipython-profile'
on_trait_change(handler, name=None, remove=False)

Setup a handler to be called when a trait changes.

This is used to setup dynamic notifications of trait changes.

Static handlers can be created by creating methods on a HasTraits subclass with the naming convention ‘_[traitname]_changed’. Thus, to create static handler for the trait ‘a’, create the method _a_changed(self, name, old, new) (fewer arguments can be used, see below).

Parameters :

handler : callable

A callable that is called when a trait changes. Its signature can be handler(), handler(name), handler(name, new) or handler(name, old, new).

name : list, str, None

If None, the handler will apply to all traits. If a list of str, handler will apply to all names in the list. If a str, the handler will apply just to that name.

remove : bool

If False (the default), then install the handler. If True then unintall it.

option_description

A trait for unicode strings.

parse_command_line(argv=None)

Parse the command line arguments.

print_alias_help()

Print the alias part of the help.

print_description()

Print the application description.

print_examples()

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_flag_help()

Print the flag part of the help.

print_help(classes=False)

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

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

print_options()
print_subcommands()

Print the subcommand part of the help.

print_version()

Print the version string.

start()
subapp

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

subcommand_description

A trait for unicode strings.

subcommands

An instance of a Python dict.

trait_metadata(traitname, key)

Get metadata values for trait by key.

trait_names(**metadata)

Get a list of all the names of this classes traits.

traits(**metadata)

Get a list of all the traits of this class.

The TraitTypes returned don’t know anything about the values that the various HasTrait’s instances are holding.

This follows the same algorithm as traits does and does not allow for any simple way of specifying merely that a metadata name exists, but has any value. This is because get_metadata returns None if a metadata key doesn’t exist.

update_config(config)

Fire the traits events when the config is updated.

version

A trait for unicode strings.