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