Show More
@@ -1,151 +1,152 b'' | |||||
1 | ===================================== |
|
1 | ===================================== | |
2 | Introduction to IPython configuration |
|
2 | Introduction to IPython configuration | |
3 | ===================================== |
|
3 | ===================================== | |
4 |
|
4 | |||
|
5 | .. _setting_config: | |||
5 |
|
6 | |||
6 | Setting configurable options |
|
7 | Setting configurable options | |
7 | ============================ |
|
8 | ============================ | |
8 |
|
9 | |||
9 | Many of IPython's classes have configurable attributes (see |
|
10 | Many of IPython's classes have configurable attributes (see | |
10 | :doc:`options/index` for the list). These can be |
|
11 | :doc:`options/index` for the list). These can be | |
11 | configured in several ways. |
|
12 | configured in several ways. | |
12 |
|
13 | |||
13 | Python config files |
|
14 | Python config files | |
14 | ------------------- |
|
15 | ------------------- | |
15 |
|
16 | |||
16 | To create the blank config files, run:: |
|
17 | To create the blank config files, run:: | |
17 |
|
18 | |||
18 | ipython profile create [profilename] |
|
19 | ipython profile create [profilename] | |
19 |
|
20 | |||
20 | If you leave out the profile name, the files will be created for the |
|
21 | If you leave out the profile name, the files will be created for the | |
21 | ``default`` profile (see :ref:`profiles`). These will typically be |
|
22 | ``default`` profile (see :ref:`profiles`). These will typically be | |
22 | located in :file:`~/.ipython/profile_default/`, and will be named |
|
23 | located in :file:`~/.ipython/profile_default/`, and will be named | |
23 | :file:`ipython_config.py`, :file:`ipython_notebook_config.py`, etc. |
|
24 | :file:`ipython_config.py`, :file:`ipython_notebook_config.py`, etc. | |
24 | The settings in :file:`ipython_config.py` apply to all IPython commands. |
|
25 | The settings in :file:`ipython_config.py` apply to all IPython commands. | |
25 |
|
26 | |||
26 | The files typically start by getting the root config object:: |
|
27 | The files typically start by getting the root config object:: | |
27 |
|
28 | |||
28 | c = get_config() |
|
29 | c = get_config() | |
29 |
|
30 | |||
30 | You can then configure class attributes like this:: |
|
31 | You can then configure class attributes like this:: | |
31 |
|
32 | |||
32 | c.InteractiveShell.automagic = False |
|
33 | c.InteractiveShell.automagic = False | |
33 |
|
34 | |||
34 | Be careful with spelling--incorrect names will simply be ignored, with |
|
35 | Be careful with spelling--incorrect names will simply be ignored, with | |
35 | no error. |
|
36 | no error. | |
36 |
|
37 | |||
37 | To add to a collection which may have already been defined elsewhere, |
|
38 | To add to a collection which may have already been defined elsewhere, | |
38 | you can use methods like those found on lists, dicts and sets: append, |
|
39 | you can use methods like those found on lists, dicts and sets: append, | |
39 | extend, :meth:`~IPython.config.loader.LazyConfigValue.prepend` (like |
|
40 | extend, :meth:`~IPython.config.loader.LazyConfigValue.prepend` (like | |
40 | extend, but at the front), add and update (which works both for dicts |
|
41 | extend, but at the front), add and update (which works both for dicts | |
41 | and sets):: |
|
42 | and sets):: | |
42 |
|
43 | |||
43 | c.InteractiveShellApp.extensions.append('rmagic') |
|
44 | c.InteractiveShellApp.extensions.append('rmagic') | |
44 |
|
45 | |||
45 | .. versionadded:: 2.0 |
|
46 | .. versionadded:: 2.0 | |
46 | list, dict and set methods for config values |
|
47 | list, dict and set methods for config values | |
47 |
|
48 | |||
48 | Example config file |
|
49 | Example config file | |
49 | ``````````````````` |
|
50 | ``````````````````` | |
50 |
|
51 | |||
51 | :: |
|
52 | :: | |
52 |
|
53 | |||
53 | # sample ipython_config.py |
|
54 | # sample ipython_config.py | |
54 | c = get_config() |
|
55 | c = get_config() | |
55 |
|
56 | |||
56 | c.TerminalIPythonApp.display_banner = True |
|
57 | c.TerminalIPythonApp.display_banner = True | |
57 | c.InteractiveShellApp.log_level = 20 |
|
58 | c.InteractiveShellApp.log_level = 20 | |
58 | c.InteractiveShellApp.extensions = [ |
|
59 | c.InteractiveShellApp.extensions = [ | |
59 | 'myextension' |
|
60 | 'myextension' | |
60 | ] |
|
61 | ] | |
61 | c.InteractiveShellApp.exec_lines = [ |
|
62 | c.InteractiveShellApp.exec_lines = [ | |
62 | 'import numpy', |
|
63 | 'import numpy', | |
63 | 'import scipy' |
|
64 | 'import scipy' | |
64 | ] |
|
65 | ] | |
65 | c.InteractiveShellApp.exec_files = [ |
|
66 | c.InteractiveShellApp.exec_files = [ | |
66 | 'mycode.py', |
|
67 | 'mycode.py', | |
67 | 'fancy.ipy' |
|
68 | 'fancy.ipy' | |
68 | ] |
|
69 | ] | |
69 | c.InteractiveShell.autoindent = True |
|
70 | c.InteractiveShell.autoindent = True | |
70 | c.InteractiveShell.colors = 'LightBG' |
|
71 | c.InteractiveShell.colors = 'LightBG' | |
71 | c.InteractiveShell.confirm_exit = False |
|
72 | c.InteractiveShell.confirm_exit = False | |
72 | c.InteractiveShell.deep_reload = True |
|
73 | c.InteractiveShell.deep_reload = True | |
73 | c.InteractiveShell.editor = 'nano' |
|
74 | c.InteractiveShell.editor = 'nano' | |
74 | c.InteractiveShell.xmode = 'Context' |
|
75 | c.InteractiveShell.xmode = 'Context' | |
75 |
|
76 | |||
76 | c.PromptManager.in_template = 'In [\#]: ' |
|
77 | c.PromptManager.in_template = 'In [\#]: ' | |
77 | c.PromptManager.in2_template = ' .\D.: ' |
|
78 | c.PromptManager.in2_template = ' .\D.: ' | |
78 | c.PromptManager.out_template = 'Out[\#]: ' |
|
79 | c.PromptManager.out_template = 'Out[\#]: ' | |
79 | c.PromptManager.justify = True |
|
80 | c.PromptManager.justify = True | |
80 |
|
81 | |||
81 | c.PrefilterManager.multi_line_specials = True |
|
82 | c.PrefilterManager.multi_line_specials = True | |
82 |
|
83 | |||
83 | c.AliasManager.user_aliases = [ |
|
84 | c.AliasManager.user_aliases = [ | |
84 | ('la', 'ls -al') |
|
85 | ('la', 'ls -al') | |
85 | ] |
|
86 | ] | |
86 |
|
87 | |||
87 |
|
88 | |||
88 | Command line arguments |
|
89 | Command line arguments | |
89 | ---------------------- |
|
90 | ---------------------- | |
90 |
|
91 | |||
91 | Every configurable value can be set from the command line, using this |
|
92 | Every configurable value can be set from the command line, using this | |
92 | syntax:: |
|
93 | syntax:: | |
93 |
|
94 | |||
94 | ipython --ClassName.attribute=value |
|
95 | ipython --ClassName.attribute=value | |
95 |
|
96 | |||
96 | Many frequently used options have short aliases and flags, such as |
|
97 | Many frequently used options have short aliases and flags, such as | |
97 | ``--matplotlib`` (to integrate with a matplotlib GUI event loop) or |
|
98 | ``--matplotlib`` (to integrate with a matplotlib GUI event loop) or | |
98 | ``--pdb`` (automatic post-mortem debugging of exceptions). |
|
99 | ``--pdb`` (automatic post-mortem debugging of exceptions). | |
99 |
|
100 | |||
100 | To see all of these abbreviated options, run:: |
|
101 | To see all of these abbreviated options, run:: | |
101 |
|
102 | |||
102 | ipython --help |
|
103 | ipython --help | |
103 | ipython notebook --help |
|
104 | ipython notebook --help | |
104 | # etc. |
|
105 | # etc. | |
105 |
|
106 | |||
106 | The config magic |
|
107 | The config magic | |
107 | ---------------- |
|
108 | ---------------- | |
108 |
|
109 | |||
109 | You can also modify config from inside IPython, using a magic command:: |
|
110 | You can also modify config from inside IPython, using a magic command:: | |
110 |
|
111 | |||
111 | %config IPCompleter.greedy = True |
|
112 | %config IPCompleter.greedy = True | |
112 |
|
113 | |||
113 | At present, this only affects the current session - changes you make to |
|
114 | At present, this only affects the current session - changes you make to | |
114 | config are not saved anywhere. |
|
115 | config are not saved anywhere. | |
115 |
|
116 | |||
116 | .. _profiles: |
|
117 | .. _profiles: | |
117 |
|
118 | |||
118 | Profiles |
|
119 | Profiles | |
119 | ======== |
|
120 | ======== | |
120 |
|
121 | |||
121 | IPython can use multiple profiles, with separate configuration and |
|
122 | IPython can use multiple profiles, with separate configuration and | |
122 | history. By default, if you don't specify a profile, IPython always runs |
|
123 | history. By default, if you don't specify a profile, IPython always runs | |
123 | in the ``default`` profile. To use a new profile:: |
|
124 | in the ``default`` profile. To use a new profile:: | |
124 |
|
125 | |||
125 | ipython profile create foo # create the profile foo |
|
126 | ipython profile create foo # create the profile foo | |
126 | ipython --profile=foo # start IPython using the new profile |
|
127 | ipython --profile=foo # start IPython using the new profile | |
127 |
|
128 | |||
128 | Profiles are typically stored in :ref:`ipythondir`, but you can also keep |
|
129 | Profiles are typically stored in :ref:`ipythondir`, but you can also keep | |
129 | a profile in the current working directory, for example to distribute it |
|
130 | a profile in the current working directory, for example to distribute it | |
130 | with a project. To find a profile directory on the filesystem:: |
|
131 | with a project. To find a profile directory on the filesystem:: | |
131 |
|
132 | |||
132 | ipython locate profile foo |
|
133 | ipython locate profile foo | |
133 |
|
134 | |||
134 | .. _ipythondir: |
|
135 | .. _ipythondir: | |
135 |
|
136 | |||
136 | The IPython directory |
|
137 | The IPython directory | |
137 | ===================== |
|
138 | ===================== | |
138 |
|
139 | |||
139 | IPython stores its files---config, command history and extensions---in |
|
140 | IPython stores its files---config, command history and extensions---in | |
140 | the directory :file:`~/.ipython/` by default. |
|
141 | the directory :file:`~/.ipython/` by default. | |
141 |
|
142 | |||
142 | .. envvar:: IPYTHONDIR |
|
143 | .. envvar:: IPYTHONDIR | |
143 |
|
144 | |||
144 | If set, this environment variable should be the path to a directory, |
|
145 | If set, this environment variable should be the path to a directory, | |
145 | which IPython will use for user data. IPython will create it if it |
|
146 | which IPython will use for user data. IPython will create it if it | |
146 | does not exist. |
|
147 | does not exist. | |
147 |
|
148 | |||
148 | .. option:: --ipython-dir=<path> |
|
149 | .. option:: --ipython-dir=<path> | |
149 |
|
150 | |||
150 | This command line option can also be used to override the default |
|
151 | This command line option can also be used to override the default | |
151 | IPython directory. |
|
152 | IPython directory. |
@@ -1,10 +1,14 b'' | |||||
1 | =============== |
|
1 | =============== | |
2 | IPython options |
|
2 | IPython options | |
3 | =============== |
|
3 | =============== | |
4 |
|
4 | |||
|
5 | Any of the options listed here can be set in config files, at the | |||
|
6 | command line, or from inside IPython. See :ref:`setting_config` for | |||
|
7 | details. | |||
|
8 | ||||
5 | .. toctree:: |
|
9 | .. toctree:: | |
6 |
|
10 | |||
7 | terminal |
|
11 | terminal | |
8 | kernel |
|
12 | kernel | |
9 | notebook |
|
13 | notebook | |
10 | qtconsole |
|
14 | qtconsole |
General Comments 0
You need to be logged in to leave comments.
Login now