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