Warning

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

Module: core.profiledir

An object for managing IPython profile directories.

2 Classes

class IPython.core.profiledir.ProfileDirError

Bases: Exception

class IPython.core.profiledir.ProfileDir(**kwargs)

Bases: IPython.config.configurable.LoggingConfigurable

An object to manage the profile directory and its resources.

The profile directory is used by all IPython applications, to manage configuration, logging and security.

This object knows how to find, create and manage these directories. This should be used by any code that wants to handle profiles.

copy_config_file(config_file, path=None, overwrite=False)

Copy a default config file into the active profile directory.

Default configuration files are kept in IPython.config.default. This function moves these from that location to the working profile directory.

classmethod create_profile_dir(profile_dir, config=None)

Create a new profile directory given a full path.

Parameters:

profile_dir : str

The full path to the profile directory. If it does exist, it will be used. If not, it will be created.

classmethod create_profile_dir_by_name(path, name='default', config=None)

Create a profile dir by profile name and path.

Parameters:

path : unicode

The path (directory) to put the profile directory in.

name : unicode

The name of the profile. The name of the profile directory will be “profile_<profile>”.

classmethod find_profile_dir(profile_dir, config=None)

Find/create a profile dir and return its ProfileDir.

This will create the profile directory if it doesn’t exist.

Parameters:

profile_dir : unicode or str

The path of the profile directory. This is expanded using IPython.utils.genutils.expand_path().

classmethod find_profile_dir_by_name(ipython_dir, name='default', config=None)

Find an existing profile dir by profile name, return its ProfileDir.

This searches through a sequence of paths for a profile dir. If it is not found, a ProfileDirError exception will be raised.

The search path algorithm is: 1. py3compat.getcwd() 2. ipython_dir

Parameters:

ipython_dir : unicode or str

The IPython directory to use.

name : unicode or str

The name of the profile. The name of the profile directory will be “profile_<profile>”.