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.profiledir

An object for managing IPython profile directories.

2 Classes

class IPython.core.profiledir.ProfileDirError

Bases: Exception

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

Bases: 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: str, path: Path, overwrite=False) bool

Copy a default config file into the active profile directory.

Default configuration files are kept in IPython.core.profile. 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.

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. os.getcwd() # removed for security reason. 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>”.

location

Set the profile location directly. This overrides the logic used by the profile option.