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