##// END OF EJS Templates
Merge pull request #9499 from Carreau/document-raise-on-config...
Thomas Kluyver -
r22397:1cdbfb28 merge
parent child Browse files
Show More
@@ -1,122 +1,135 b''
1 1 .. _config_overview:
2 2
3 3 ============================================
4 4 Overview of the IPython configuration system
5 5 ============================================
6 6
7 7 This section describes the IPython configuration system. This is based on
8 8 :mod:`traitlets.config`; see that documentation for more information
9 9 about the overall architecture.
10 10
11 11 Configuration file location
12 12 ===========================
13 13
14 14 So where should you put your configuration files? IPython uses "profiles" for
15 15 configuration, and by default, all profiles will be stored in the so called
16 16 "IPython directory". The location of this directory is determined by the
17 17 following algorithm:
18 18
19 19 * If the ``ipython-dir`` command line flag is given, its value is used.
20 20
21 21 * If not, the value returned by :func:`IPython.paths.get_ipython_dir`
22 22 is used. This function will first look at the :envvar:`IPYTHONDIR`
23 23 environment variable and then default to :file:`~/.ipython`.
24 24 Historical support for the :envvar:`IPYTHON_DIR` environment variable will
25 25 be removed in a future release.
26 26
27 27 For most users, the configuration directory will be :file:`~/.ipython`.
28 28
29 29 Previous versions of IPython on Linux would use the XDG config directory,
30 30 creating :file:`~/.config/ipython` by default. We have decided to go
31 31 back to :file:`~/.ipython` for consistency among systems. IPython will
32 32 issue a warning if it finds the XDG location, and will move it to the new
33 33 location if there isn't already a directory there.
34 34
35 35 Once the location of the IPython directory has been determined, you need to know
36 36 which profile you are using. For users with a single configuration, this will
37 37 simply be 'default', and will be located in
38 38 :file:`<IPYTHONDIR>/profile_default`.
39 39
40 40 The next thing you need to know is what to call your configuration file. The
41 41 basic idea is that each application has its own default configuration filename.
42 42 The default named used by the :command:`ipython` command line program is
43 43 :file:`ipython_config.py`, and *all* IPython applications will use this file.
44 44 Other applications, such as the parallel :command:`ipcluster` scripts or the
45 45 QtConsole will load their own config files *after* :file:`ipython_config.py`. To
46 46 load a particular configuration file instead of the default, the name can be
47 47 overridden by the ``config_file`` command line flag.
48 48
49 49 To generate the default configuration files, do::
50 50
51 51 $ ipython profile create
52 52
53 53 and you will have a default :file:`ipython_config.py` in your IPython directory
54 54 under :file:`profile_default`. If you want the default config files for the
55 55 :mod:`IPython.parallel` applications, add ``--parallel`` to the end of the
56 56 command-line args.
57 57
58 .. note::
59
60 IPython configuration options are case sensitive, and IPython cannot
61 catch misnamed keys or invalid values.
62
63 By default IPython will also ignore any invalid configuration files.
64
65 .. versionadded:: 5.0
66
67 IPython can be configured to abort in case of invalid configuration file.
68 To do so set the environment variable ``IPYTHON_SUPPRESS_CONFIG_ERRORS`` to
69 `'1'` or `'true'`
70
58 71
59 72 Locating these files
60 73 --------------------
61 74
62 75 From the command-line, you can quickly locate the IPYTHONDIR or a specific
63 76 profile with:
64 77
65 78 .. sourcecode:: bash
66 79
67 80 $ ipython locate
68 81 /home/you/.ipython
69 82
70 83 $ ipython locate profile foo
71 84 /home/you/.ipython/profile_foo
72 85
73 86 These map to the utility functions: :func:`IPython.utils.path.get_ipython_dir`
74 87 and :func:`IPython.utils.path.locate_profile` respectively.
75 88
76 89
77 90 .. _profiles_dev:
78 91
79 92 Profiles
80 93 ========
81 94
82 95 A profile is a directory containing configuration and runtime files, such as
83 96 logs, connection info for the parallel apps, and your IPython command history.
84 97
85 98 The idea is that users often want to maintain a set of configuration files for
86 99 different purposes: one for doing numerical computing with NumPy and SciPy and
87 100 another for doing symbolic computing with SymPy. Profiles make it easy to keep a
88 101 separate configuration files, logs, and histories for each of these purposes.
89 102
90 103 Let's start by showing how a profile is used:
91 104
92 105 .. code-block:: bash
93 106
94 107 $ ipython --profile=sympy
95 108
96 109 This tells the :command:`ipython` command line program to get its configuration
97 110 from the "sympy" profile. The file names for various profiles do not change. The
98 111 only difference is that profiles are named in a special way. In the case above,
99 112 the "sympy" profile means looking for :file:`ipython_config.py` in :file:`<IPYTHONDIR>/profile_sympy`.
100 113
101 114 The general pattern is this: simply create a new profile with:
102 115
103 116 .. code-block:: bash
104 117
105 118 $ ipython profile create <name>
106 119
107 120 which adds a directory called ``profile_<name>`` to your IPython directory. Then
108 121 you can load this profile by adding ``--profile=<name>`` to your command line
109 122 options. Profiles are supported by all IPython applications.
110 123
111 124 IPython ships with some sample profiles in :file:`IPython/config/profile`. If
112 125 you create profiles with the name of one of our shipped profiles, these config
113 126 files will be copied over instead of starting with the automatically generated
114 127 config files.
115 128
116 129 IPython extends the config loader for Python files so that you can inherit
117 130 config from another profile. To do this, use a line like this in your Python
118 131 config file:
119 132
120 133 .. sourcecode:: python
121 134
122 135 load_subconfig('ipython_config.py', profile='default')
General Comments 0
You need to be logged in to leave comments. Login now