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