##// END OF EJS Templates
Fix undefined labels in docs #2
klonuo -
Show More
@@ -1,249 +1,249 b''
1 1 =================
2 2 Python vs IPython
3 3 =================
4 4
5 5 This document is meant to highlight the main differences between the Python
6 6 language and what are the specific construct you can do only in IPython.
7 7
8 8 Unless expressed otherwise all of the construct you will see here will raise a
9 9 ``SyntaxError`` if run in a pure Python shell, or if executing in a Python
10 10 script.
11 11
12 12 Each of these features are describe more in details in further part of the documentation.
13 13
14 14
15 15 Quick overview:
16 16 ===============
17 17
18 18
19 19 All the following construct are valid IPython syntax:
20 20
21 21 .. code-block:: ipython
22 22
23 23 In [1]: ?
24 24
25 25 .. code-block:: ipython
26 26
27 27 In [1]: ?object
28 28
29 29
30 30 .. code-block:: ipython
31 31
32 32 In [1]: object?
33 33
34 34 .. code-block:: ipython
35 35
36 36 In [1]: *pattern*?
37 37
38 38 .. code-block:: ipython
39 39
40 40 In [1]: %shell like --syntax
41 41
42 42 .. code-block:: ipython
43 43
44 44 In [1]: !ls
45 45
46 46 .. code-block:: ipython
47 47
48 48 In [1]: my_files =! ls ~/
49 49 In [1]: for i,file in enumerate(my_file):
50 50 ...: raw = !echo $file
51 51 ...: !echo {files[0].upper()} $raw
52 52
53 53
54 54 .. code-block:: ipython
55 55
56 56 In [1]: %%perl magic --function
57 57 ...: @months = ("July", "August", "September");
58 58 ...: print $months[0];
59 59
60 60
61 61 Each of these construct is compile by IPython into valid python code and will
62 62 do most of the time what you expect it will do. Let see each of these example
63 63 in more detail.
64 64
65 65
66 66 Accessing help
67 67 ==============
68 68
69 69 As IPython is mostly an interactive shell, the question mark is a simple
70 70 shortcut to get help. A question mark alone will bring up the IPython help:
71 71
72 72 .. code-block:: ipython
73 73
74 74 In [1]: ?
75 75
76 76 IPython -- An enhanced Interactive Python
77 77 =========================================
78 78
79 79 IPython offers a combination of convenient shell features, special commands
80 80 and a history mechanism for both input (command history) and output (results
81 81 caching, similar to Mathematica). It is intended to be a fully compatible
82 82 replacement for the standard Python interpreter, while offering vastly
83 83 improved functionality and flexibility.
84 84
85 85 At your system command line, type 'ipython -h' to see the command line
86 86 options available. This document only describes interactive features.
87 87
88 88 MAIN FEATURES
89 89 -------------
90 90 ...
91 91
92 92 A single question mark before, or after an object available in current
93 93 namespace will show help relative to this object:
94 94
95 95 .. code-block:: ipython
96 96
97 97 In [6]: object?
98 98 Docstring: The most base type
99 99 Type: type
100 100
101 101
102 102 A double question mark will try to pull out more information about the object,
103 103 and if possible display the python source code of this object.
104 104
105 105 .. code-block:: ipython
106 106
107 107 In[1]: import collections
108 108 In[2]: collection.Counter??
109 109
110 110 Init signature: collections.Counter(*args, **kwds)
111 111 Source:
112 112 class Counter(dict):
113 113 '''Dict subclass for counting hashable items. Sometimes called a bag
114 114 or multiset. Elements are stored as dictionary keys and their counts
115 115 are stored as dictionary values.
116 116
117 117 >>> c = Counter('abcdeabcdabcaba') # count elements from a string
118 118
119 119 >>> c.most_common(3) # three most common elements
120 120 [('a', 5), ('b', 4), ('c', 3)]
121 121 >>> sorted(c) # list all unique elements
122 122 ['a', 'b', 'c', 'd', 'e']
123 123 >>> ''.join(sorted(c.elements())) # list elements with repetitions
124 124 'aaaaabbbbcccdde'
125 125 ...
126 126
127 127
128 128
129 129 If you are looking for an object, the use of wildcards ``*`` in conjunction
130 130 with question mark will allow you to search current namespace for object with
131 131 matching names:
132 132
133 133 .. code-block:: ipython
134 134
135 135 In [24]: *int*?
136 136 FloatingPointError
137 137 int
138 138 print
139 139
140 140
141 141 Shell Assignment
142 142 ================
143 143
144 144
145 145 When doing interactive computing it is common to need to access the underlying shell.
146 146 This is doable through the use of the exclamation mark ``!`` (or bang).
147 147
148 148 This allow to execute simple command when present in beginning of line:
149 149
150 150 .. code-block:: ipython
151 151
152 152 In[1]: !pwd
153 153 /User/home/
154 154
155 155 Change directory:
156 156
157 157 .. code-block:: ipython
158 158
159 159 In[1]: !cd /var/etc
160 160
161 161 Or edit file:
162 162
163 163 .. code-block:: ipython
164 164
165 165 In[1]: !mvim myfile.txt
166 166
167 167
168 168 The line after the bang can call any program installed in the underlying
169 169 shell, and support variable expansion in the form of ``$variable`` or ``{variable}``.
170 170 The later form of expansion supports arbitrary python expression:
171 171
172 172 .. code-block:: ipython
173 173
174 174 In[1]: file = 'myfile.txt'
175 175
176 176 In[2]: !mv $file {file.upper()}
177 177
178 178
179 179 The bang can also be present in the right hand side of an assignment, just
180 180 after the equal sign, or separated from it by a white space. In which case the
181 181 standard output of the command after the bang ``!`` will be split out into lines
182 in a list-like object (:ref:`IPython Slist`) and assign to the left hand side.
182 in a list-like object and assign to the left hand side.
183 183
184 184 This allow you for example to put the list of files of the current working directory in a variable:
185 185
186 186 .. code-block:: ipython
187 187
188 188 In[1]: my_files != ls
189 189
190 190
191 191 You can combine the different possibilities in for loops, condition, functions...:
192 192
193 193 .. code-block:: ipython
194 194
195 195 my_files =! ls ~/
196 196 b = "backup file"
197 197 for i,file in enumerate(my_file):
198 198 raw = !echo $backup $file
199 199 !cp $file {file.split('.')[0]+'.bak'}
200 200
201 201
202 202 Magics
203 203 ------
204 204
205 205 Magics function are often present in the form of shell-like syntax, but are
206 206 under the hood python function. The syntax and assignment possibility are
207 207 similar to the one with the bang (``!``) syntax, but with more flexibility and
208 208 power. Magic function start with a percent sign (``%``) or double percent (``%%``).
209 209
210 210 A magic call with a sign percent will act only one line:
211 211
212 212 .. code-block:: ipython
213 213
214 214 In[1]: %xmode
215 215 Exception reporting mode: Verbose
216 216
217 217 And support assignment:
218 218
219 219 .. code-block:: ipython
220 220
221 221 In [1]: results = %timeit -r1 -n1 -o list(range(1000))
222 222 1 loops, best of 1: 21.1 Β΅s per loop
223 223
224 224 In [2]: results
225 225 Out[2]: <TimeitResult : 1 loops, best of 1: 21.1 Β΅s per loop>
226 226
227 227 Magic with two percent sign can spread over multiple lines, but do not support assignment:
228 228
229 229 .. code-block:: ipython
230 230
231 231 In[1]: %%bash
232 232 ... : echo "My shell is:" $SHELL
233 233 ... : echo "My disk usage is:"
234 234 ... : df -h
235 235 My shell is: /usr/local/bin/bash
236 236 My disk usage is:
237 237 Filesystem Size Used Avail Capacity iused ifree %iused Mounted on
238 238 /dev/disk1 233Gi 216Gi 16Gi 94% 56788108 4190706 93% /
239 239 devfs 190Ki 190Ki 0Bi 100% 656 0 100% /dev
240 240 map -hosts 0Bi 0Bi 0Bi 100% 0 0 100% /net
241 241 map auto_home 0Bi 0Bi 0Bi 100% 0 0 100% /hom
242 242
243 243
244 244 Combining it all
245 245 ----------------
246 246
247 247 ::
248 248
249 249 find a snippet that combine all that into one thing!
@@ -1,291 +1,291 b''
1 1 .. _overview:
2 2
3 3 ============
4 4 Introduction
5 5 ============
6 6
7 7 Overview
8 8 ========
9 9
10 10 One of Python's most useful features is its interactive interpreter.
11 11 It allows for very fast testing of ideas without the overhead of
12 12 creating test files as is typical in most programming languages.
13 13 However, the interpreter supplied with the standard Python distribution
14 14 is somewhat limited for extended interactive use.
15 15
16 16 The goal of IPython is to create a comprehensive environment for
17 17 interactive and exploratory computing. To support this goal, IPython
18 18 has three main components:
19 19
20 20 * An enhanced interactive Python shell.
21 21 * A decoupled :ref:`two-process communication model <ipythonzmq>`, which
22 22 allows for multiple clients to connect to a computation kernel, most notably
23 the web-based :ref:`notebook <htmlnotebook>`
23 the web-based notebook.
24 24 * An architecture for interactive parallel computing.
25 25
26 26 All of IPython is open source (released under the revised BSD license).
27 27
28 28 Enhanced interactive Python shell
29 29 =================================
30 30
31 31 IPython's interactive shell (:command:`ipython`), has the following goals,
32 32 amongst others:
33 33
34 34 1. Provide an interactive shell superior to Python's default. IPython
35 35 has many features for tab-completion, object introspection, system shell
36 36 access, command history retrieval across sessions, and its own special
37 37 command system for adding functionality when working interactively. It
38 38 tries to be a very efficient environment both for Python code development
39 39 and for exploration of problems using Python objects (in situations like
40 40 data analysis).
41 41
42 42 2. Serve as an embeddable, ready to use interpreter for your own
43 43 programs. An interactive IPython shell can be started with a single call
44 44 from inside another program, providing access to the current namespace.
45 45 This can be very useful both for debugging purposes and for situations
46 46 where a blend of batch-processing and interactive exploration are needed.
47 47
48 48 3. Offer a flexible framework which can be used as the base
49 49 environment for working with other systems, with Python as the underlying
50 50 bridge language. Specifically scientific environments like Mathematica,
51 51 IDL and Matlab inspired its design, but similar ideas can be
52 52 useful in many fields.
53 53
54 54 4. Allow interactive testing of threaded graphical toolkits. IPython
55 55 has support for interactive, non-blocking control of GTK, Qt, WX, GLUT, and
56 56 OS X applications via special threading flags. The normal Python
57 57 shell can only do this for Tkinter applications.
58 58
59 59 Main features of the interactive shell
60 60 --------------------------------------
61 61
62 62 * Dynamic object introspection. One can access docstrings, function
63 63 definition prototypes, source code, source files and other details
64 64 of any object accessible to the interpreter with a single
65 65 keystroke (:samp:`?`, and using :samp:`??` provides additional detail).
66 66
67 67 * Searching through modules and namespaces with :samp:`*` wildcards, both
68 68 when using the :samp:`?` system and via the :samp:`%psearch` command.
69 69
70 70 * Completion in the local namespace, by typing :kbd:`TAB` at the prompt.
71 71 This works for keywords, modules, methods, variables and files in the
72 72 current directory. This is supported via the readline library, and
73 73 full access to configuring readline's behavior is provided.
74 74 Custom completers can be implemented easily for different purposes
75 75 (system commands, magic arguments etc.)
76 76
77 77 * Numbered input/output prompts with command history (persistent
78 78 across sessions and tied to each profile), full searching in this
79 79 history and caching of all input and output.
80 80
81 81 * User-extensible 'magic' commands. A set of commands prefixed with
82 82 :samp:`%` is available for controlling IPython itself and provides
83 83 directory control, namespace information and many aliases to
84 84 common system shell commands.
85 85
86 86 * Alias facility for defining your own system aliases.
87 87
88 88 * Complete system shell access. Lines starting with :samp:`!` are passed
89 89 directly to the system shell, and using :samp:`!!` or :samp:`var = !cmd`
90 90 captures shell output into python variables for further use.
91 91
92 92 * The ability to expand python variables when calling the system shell. In a
93 93 shell command, any python variable prefixed with :samp:`$` is expanded. A
94 94 double :samp:`$$` allows passing a literal :samp:`$` to the shell (for access
95 95 to shell and environment variables like :envvar:`PATH`).
96 96
97 97 * Filesystem navigation, via a magic :samp:`%cd` command, along with a
98 98 persistent bookmark system (using :samp:`%bookmark`) for fast access to
99 99 frequently visited directories.
100 100
101 101 * A lightweight persistence framework via the :samp:`%store` command, which
102 102 allows you to save arbitrary Python variables. These get restored
103 103 when you run the :samp:`%store -r` command.
104 104
105 105 * Automatic indentation (optional) of code as you type (through the
106 106 readline library).
107 107
108 108 * Macro system for quickly re-executing multiple lines of previous
109 109 input with a single name via the :samp:`%macro` command. Macros can be
110 110 stored persistently via :samp:`%store` and edited via :samp:`%edit`.
111 111
112 112 * Session logging (you can then later use these logs as code in your
113 113 programs). Logs can optionally timestamp all input, and also store
114 114 session output (marked as comments, so the log remains valid
115 115 Python source code).
116 116
117 117 * Session restoring: logs can be replayed to restore a previous
118 118 session to the state where you left it.
119 119
120 120 * Verbose and colored exception traceback printouts. Easier to parse
121 121 visually, and in verbose mode they produce a lot of useful
122 122 debugging information (basically a terminal version of the cgitb
123 123 module).
124 124
125 125 * Auto-parentheses via the :samp:`%autocall` command: callable objects can be
126 126 executed without parentheses: :samp:`sin 3` is automatically converted to
127 127 :samp:`sin(3)`
128 128
129 129 * Auto-quoting: using :samp:`,`, or :samp:`;` as the first character forces
130 130 auto-quoting of the rest of the line: :samp:`,my_function a b` becomes
131 131 automatically :samp:`my_function("a","b")`, while :samp:`;my_function a b`
132 132 becomes :samp:`my_function("a b")`.
133 133
134 134 * Extensible input syntax. You can define filters that pre-process
135 135 user input to simplify input in special situations. This allows
136 136 for example pasting multi-line code fragments which start with
137 137 :samp:`>>>` or :samp:`...` such as those from other python sessions or the
138 138 standard Python documentation.
139 139
140 140 * Flexible :ref:`configuration system <config_overview>`. It uses a
141 141 configuration file which allows permanent setting of all command-line
142 142 options, module loading, code and file execution. The system allows
143 143 recursive file inclusion, so you can have a base file with defaults and
144 144 layers which load other customizations for particular projects.
145 145
146 146 * Embeddable. You can call IPython as a python shell inside your own
147 147 python programs. This can be used both for debugging code or for
148 148 providing interactive abilities to your programs with knowledge
149 149 about the local namespaces (very useful in debugging and data
150 150 analysis situations).
151 151
152 152 * Easy debugger access. You can set IPython to call up an enhanced version of
153 153 the Python debugger (pdb) every time there is an uncaught exception. This
154 154 drops you inside the code which triggered the exception with all the data
155 155 live and it is possible to navigate the stack to rapidly isolate the source
156 156 of a bug. The :samp:`%run` magic command (with the :samp:`-d` option) can run
157 157 any script under pdb's control, automatically setting initial breakpoints for
158 158 you. This version of pdb has IPython-specific improvements, including
159 159 tab-completion and traceback coloring support. For even easier debugger
160 160 access, try :samp:`%debug` after seeing an exception.
161 161
162 162 * Profiler support. You can run single statements (similar to
163 163 :samp:`profile.run()`) or complete programs under the profiler's control.
164 164 While this is possible with standard cProfile or profile modules,
165 165 IPython wraps this functionality with magic commands (see :samp:`%prun`
166 166 and :samp:`%run -p`) convenient for rapid interactive work.
167 167
168 168 * Simple timing information. You can use the :samp:`%timeit` command to get
169 169 the execution time of a Python statement or expression. This machinery is
170 170 intelligent enough to do more repetitions for commands that finish very
171 171 quickly in order to get a better estimate of their running time.
172 172
173 173 .. sourcecode:: ipython
174 174
175 175 In [1]: %timeit 1+1
176 176 10000000 loops, best of 3: 25.5 ns per loop
177 177
178 178 In [2]: %timeit [math.sin(x) for x in range(5000)]
179 179 1000 loops, best of 3: 719 Β΅s per loop
180 180
181 181 ..
182 182
183 183 To get the timing information for more than one expression, use the
184 184 :samp:`%%timeit` cell magic command.
185 185
186 186
187 187 * Doctest support. The special :samp:`%doctest_mode` command toggles a mode
188 188 to use doctest-compatible prompts, so you can use IPython sessions as
189 189 doctest code. By default, IPython also allows you to paste existing
190 190 doctests, and strips out the leading :samp:`>>>` and :samp:`...` prompts in
191 191 them.
192 192
193 193 .. _ipythonzmq:
194 194
195 195 Decoupled two-process model
196 196 ==============================
197 197
198 198 IPython has abstracted and extended the notion of a traditional
199 199 *Read-Evaluate-Print Loop* (REPL) environment by decoupling the *evaluation*
200 200 into its own process. We call this process a **kernel**: it receives execution
201 201 instructions from clients and communicates the results back to them.
202 202
203 203 This decoupling allows us to have several clients connected to the same
204 204 kernel, and even allows clients and kernels to live on different machines.
205 205 With the exclusion of the traditional single process terminal-based IPython
206 206 (what you start if you run ``ipython`` without any subcommands), all
207 207 other IPython machinery uses this two-process model. This includes ``ipython
208 208 console``, ``ipython qtconsole``, and ``ipython notebook``.
209 209
210 210 As an example, this means that when you start ``ipython qtconsole``, you're
211 211 really starting two processes, a kernel and a Qt-based client can send
212 212 commands to and receive results from that kernel. If there is already a kernel
213 213 running that you want to connect to, you can pass the ``--existing`` flag
214 214 which will skip initiating a new kernel and connect to the most recent kernel,
215 215 instead. To connect to a specific kernel once you have several kernels
216 216 running, use the ``%connect_info`` magic to get the unique connection file,
217 217 which will be something like ``--existing kernel-19732.json`` but with
218 218 different numbers which correspond to the Process ID of the kernel.
219 219
220 220 You can read more about using `ipython qtconsole
221 221 <http://jupyter.org/qtconsole/>`_, and
222 222 `ipython notebook <http://jupyter-notebook.readthedocs.io/en/latest/>`_. There
223 223 is also a :ref:`message spec <messaging>` which documents the protocol for
224 224 communication between kernels
225 225 and clients.
226 226
227 227 .. seealso::
228 228
229 229 `Frontend/Kernel Model`_ example notebook
230 230
231 231
232 232 Interactive parallel computing
233 233 ==============================
234 234
235 235 Increasingly, parallel computer hardware, such as multicore CPUs, clusters and
236 236 supercomputers, is becoming ubiquitous. Over the last several years, we have
237 237 developed an architecture within IPython that allows such hardware to be used
238 238 quickly and easily from Python. Moreover, this architecture is designed to
239 239 support interactive and collaborative parallel computing.
240 240
241 241 The main features of this system are:
242 242
243 243 * Quickly parallelize Python code from an interactive Python/IPython session.
244 244
245 245 * A flexible and dynamic process model that be deployed on anything from
246 246 multicore workstations to supercomputers.
247 247
248 248 * An architecture that supports many different styles of parallelism, from
249 249 message passing to task farming. And all of these styles can be handled
250 250 interactively.
251 251
252 252 * Both blocking and fully asynchronous interfaces.
253 253
254 254 * High level APIs that enable many things to be parallelized in a few lines
255 255 of code.
256 256
257 257 * Write parallel code that will run unchanged on everything from multicore
258 258 workstations to supercomputers.
259 259
260 260 * Full integration with Message Passing libraries (MPI).
261 261
262 262 * Capabilities based security model with full encryption of network connections.
263 263
264 264 * Share live parallel jobs with other users securely. We call this
265 265 collaborative parallel computing.
266 266
267 267 * Dynamically load balanced task farming system.
268 268
269 269 * Robust error handling. Python exceptions raised in parallel execution are
270 270 gathered and presented to the top-level code.
271 271
272 272 For more information, see our :ref:`overview <parallel_index>` of using IPython
273 273 for parallel computing.
274 274
275 275 Portability and Python requirements
276 276 -----------------------------------
277 277
278 278 As of the 2.0 release, IPython works with Python 2.7 and 3.3 or above.
279 279 Version 1.0 additionally worked with Python 2.6 and 3.2.
280 280 Version 0.12 was the first version to fully support Python 3.
281 281
282 282 IPython is known to work on the following operating systems:
283 283
284 284 * Linux
285 285 * Most other Unix-like OSs (AIX, Solaris, BSD, etc.)
286 286 * Mac OS X
287 287 * Windows (CygWin, XP, Vista, etc.)
288 288
289 289 See :ref:`here <install_index>` for instructions on how to install IPython.
290 290
291 291 .. include:: links.txt
@@ -1,370 +1,369 b''
1 1 =============
2 2 0.12 Series
3 3 =============
4 4
5 5 Release 0.12.1
6 6 ==============
7 7
8 8 IPython 0.12.1 is a bugfix release of 0.12, pulling only bugfixes and minor
9 9 cleanup from 0.13, timed for the Ubuntu 12.04 LTS release.
10 10
11 11 See the :ref:`list of fixed issues <issues_list_012>` for specific backported issues.
12 12
13 13
14 14 Release 0.12
15 15 ============
16 16
17 17 IPython 0.12 contains several major new features, as well as a large amount of
18 18 bug and regression fixes. The 0.11 release brought with it a lot of new
19 19 functionality and major refactorings of the codebase; by and large this has
20 20 proven to be a success as the number of contributions to the project has
21 21 increased dramatically, proving that the code is now much more approachable.
22 22 But in the refactoring inevitably some bugs were introduced, and we have also
23 23 squashed many of those as well as recovered some functionality that had been
24 24 temporarily disabled due to the API changes.
25 25
26 26 The following major new features appear in this version.
27 27
28 28
29 29 An interactive browser-based Notebook with rich media support
30 30 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
31 31
32 32 A powerful new interface puts IPython in your browser. You can start it with
33 33 the command ``ipython notebook``:
34 34
35 35 .. figure:: ../_images/notebook_specgram.png
36 36 :width: 400px
37 37 :alt: The IPython notebook with embedded text, code, math and figures.
38 38 :align: center
39 39 :target: ../_images/notebook_specgram.png
40 40
41 41 The new IPython notebook showing text, mathematical expressions in LaTeX,
42 42 code, results and embedded figures created with Matplotlib.
43 43
44 44 This new interface maintains all the features of IPython you are used to, as it
45 45 is a new client that communicates with the same IPython kernels used by the
46 46 terminal and Qt console. But the web notebook provides for a different
47 47 workflow where you can integrate, along with code execution, also text,
48 48 mathematical expressions, graphics, video, and virtually any content that a
49 49 modern browser is capable of displaying.
50 50
51 51 You can save your work sessions as documents that retain all these elements and
52 52 which can be version controlled, emailed to colleagues or saved as HTML or PDF
53 53 files for printing or publishing statically on the web. The internal storage
54 54 format is a JSON file that can be easily manipulated for manual exporting to
55 55 other formats.
56 56
57 57 This Notebook is a major milestone for IPython, as for years we have tried to
58 58 build this kind of system. We were inspired originally by the excellent
59 59 implementation in Mathematica, we made a number of attempts using older
60 60 technologies in earlier Summer of Code projects in 2005 (both students and
61 61 Robert Kern developed early prototypes), and in recent years we have seen the
62 62 excellent implementation offered by the `Sage <http://sagemath.org>` system.
63 63 But we continued to work on something that would be consistent with the rest of
64 64 IPython's design, and it is clear now that the effort was worth it: based on
65 65 the ZeroMQ communications architecture introduced in version 0.11, the notebook
66 66 can now retain 100% of the features of the real IPython. But it can also
67 67 provide the rich media support and high quality Javascript libraries that were
68 68 not available in browsers even one or two years ago (such as high-quality
69 69 mathematical rendering or built-in video).
70 70
71 71 The notebook has too many useful and important features to describe in these
72 72 release notes; our documentation now contains a directory called
73 73 ``examples/notebooks`` with several notebooks that illustrate various aspects
74 74 of the system. You should start by reading those named
75 75 ``00_notebook_tour.ipynb`` and ``01_notebook_introduction.ipynb`` first, and
76 76 then can proceed to read the others in any order you want.
77 77
78 78 To start the notebook server, go to a directory containing the notebooks you
79 79 want to open (or where you want to create new ones) and type::
80 80
81 81 ipython notebook
82 82
83 83 You can see all the relevant options with::
84 84
85 85 ipython notebook --help
86 86 ipython notebook --help-all # even more
87 87
88 88 and just like the Qt console, you can start the notebook server with pylab
89 89 support by using::
90 90
91 91 ipython notebook --pylab
92 92
93 93 for floating matplotlib windows or::
94 94
95 95 ipython notebook --pylab inline
96 96
97 97 for plotting support with automatically inlined figures. Note that it is now
98 98 possible also to activate pylab support at runtime via ``%pylab``, so you do
99 99 not need to make this decision when starting the server.
100
101 See :ref:`the Notebook docs <htmlnotebook>` for technical details.
100
102 101
103 102 .. _two_process_console:
104 103
105 104 Two-process terminal console
106 105 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
107 106
108 107 Based on the same architecture as the notebook and the Qt console, we also have
109 108 now a terminal-based console that can connect to an external IPython kernel
110 109 (the same kernels used by the Qt console or the notebook, in fact). While this
111 110 client behaves almost identically to the usual IPython terminal application,
112 111 this capability can be very useful to attach an interactive console to an
113 112 existing kernel that was started externally. It lets you use the interactive
114 113 ``%debug`` facilities in a notebook, for example (the web browser can't
115 114 interact directly with the debugger) or debug a third-party code where you may
116 115 have embedded an IPython kernel.
117 116
118 117 This is also something that we have wanted for a long time, and which is a
119 118 culmination (as a team effort) of the work started last year during the 2010
120 119 Google Summer of Code project.
121 120
122 121 Tabbed QtConsole
123 122 ~~~~~~~~~~~~~~~~
124 123
125 124 The QtConsole now supports starting multiple kernels in tabs, and has a
126 125 menubar, so it looks and behaves more like a real application. Keyboard
127 126 enthusiasts can disable the menubar with ctrl-shift-M (:ghpull:`887`).
128 127
129 128 .. figure:: ../_images/qtconsole_tabbed.png
130 129 :width: 400px
131 130 :alt: Tabbed IPython Qt console with embedded plots and menus.
132 131 :align: center
133 132 :target: ../_images/qtconsole_tabbed.png
134 133
135 134 The improved Qt console for IPython, now with tabs to control multiple
136 135 kernels and full menu support.
137 136
138 137
139 138 Full Python 3 compatibility
140 139 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
141 140
142 141 IPython can now be installed from a single codebase on Python 2 and
143 142 Python 3. The installation process for Python 3 automatically runs 2to3. The
144 143 same 'default' profile is now used for Python 2 and 3 (the previous version had
145 144 a separate 'python3' profile).
146 145
147 146 Standalone Kernel
148 147 ~~~~~~~~~~~~~~~~~
149 148
150 149 The ``ipython kernel`` subcommand has been added, to allow starting a
151 150 standalone kernel, that can be used with various frontends. You can then later
152 151 connect a Qt console or a terminal console to this kernel by typing e.g.::
153 152
154 153 ipython qtconsole --existing
155 154
156 155 if it's the only one running, or by passing explicitly the connection
157 156 parameters (printed by the kernel at startup).
158 157
159 158
160 159 PyPy support
161 160 ~~~~~~~~~~~~
162 161
163 162 The terminal interface to IPython now runs under `PyPy <http://pypy.org/>`_.
164 163 We will continue to monitor PyPy's progress, and hopefully before long at least
165 164 we'll be able to also run the notebook. The Qt console may take longer, as Qt
166 165 is a very complex set of bindings to a huge C++ library, and that is currently
167 166 the area where PyPy still lags most behind. But for everyday interactive use
168 167 at the terminal, with this release and PyPy 1.7, things seem to work quite well
169 168 from our admittedly limited testing.
170 169
171 170
172 171 Other important new features
173 172 ----------------------------
174 173
175 174 * **SSH Tunnels**: In 0.11, the :mod:`IPython.parallel` Client could tunnel its
176 connections to the Controller via ssh. Now, the QtConsole :ref:`supports
177 <ssh_tunnels>` ssh tunneling, as do parallel engines.
175 connections to the Controller via ssh. Now, the QtConsole supports ssh tunneling,
176 as do parallel engines.
178 177
179 178 * **relaxed command-line parsing**: 0.11 was released with overly-strict
180 179 command-line parsing, preventing the ability to specify arguments with spaces,
181 180 e.g. ``ipython --pylab qt`` or ``ipython -c "print 'hi'"``. This has
182 181 been fixed, by using argparse. The new parsing is a strict superset of 0.11, so
183 182 any commands in 0.11 should still work in 0.12.
184 183
185 184 * **HistoryAccessor**: The :class:`~IPython.core.history.HistoryManager` class
186 185 for interacting with your IPython SQLite history database has been split,
187 186 adding a parent :class:`~IPython.core.history.HistoryAccessor` class, so that
188 187 users can write code to access and search their IPython history without being
189 188 in an IPython session (:ghpull:`824`).
190 189
191 190 * **kernel %gui and %pylab**: The ``%gui`` and ``%pylab`` magics have been
192 191 restored to the IPython kernel (e.g. in the qtconsole or notebook). This
193 192 allows activation of pylab-mode, or eventloop integration after starting the
194 193 kernel, which was unavailable in 0.11. Unlike in the terminal, this can be
195 194 set only once, and cannot be changed.
196 195
197 196 * **%config**: A new ``%config`` magic has been added, giving easy access to the
198 197 IPython configuration system at runtime (:ghpull:`923`).
199 198
200 199 * **Multiline History**: Multiline readline history has been restored to the
201 200 Terminal frontend by default (:ghpull:`838`).
202 201
203 202 * **%store**: The ``%store`` magic from earlier versions has been updated and
204 203 re-enabled (:ref:`extensions_storemagic`; :ghpull:`1029`). To autorestore
205 204 stored variables on startup, specify ``c.StoreMagic.autorestore = True`` in
206 205 :file:`ipython_config.py`.
207 206
208 207
209 208 Major Bugs fixed
210 209 ----------------
211 210
212 211 In this cycle, we have :ref:`closed over 500 issues <issues_list_012>`, but a
213 212 few major ones merit special mention:
214 213
215 214 * Simple configuration errors should no longer crash IPython. In 0.11, errors
216 215 in config files, as well as invalid trait values, could crash IPython. Now,
217 216 such errors are reported, and help is displayed.
218 217
219 218 * Certain SyntaxErrors no longer crash IPython (e.g. just typing keywords, such
220 219 as ``return``, ``break``, etc.). See :ghissue:`704`.
221 220
222 221 * IPython path utils, such as :func:`~IPython.utils.path.get_ipython_dir` now
223 222 check for write permissions, so IPython should function on systems where the
224 223 default path resolution might point to a read-only location, such as
225 224 ``HOMESHARE`` on Windows (:ghissue:`669`).
226 225
227 226 * :func:`raw_input` now works in the kernel when multiple frontends are in
228 227 use. The request will be sent to the frontend that made the request, and an
229 228 exception is raised if that frontend does not support stdin requests
230 229 (e.g. the notebook) (:ghissue:`673`).
231 230
232 231 * :mod:`zmq` version detection no longer uses simple lexicographical comparison
233 232 to check minimum version, which prevents 0.11 from working with pyzmq-2.1.10
234 233 (:ghpull:`758`).
235 234
236 235 * A bug in PySide < 1.0.7 caused crashes on OSX when tooltips were shown
237 236 (:ghissue:`711`). these tooltips are now disabled on old PySide
238 237 (:ghpull:`963`).
239 238
240 239 * IPython no longer crashes when started on recent versions of Python 3 in
241 240 Windows (:ghissue:`737`).
242 241
243 242 * Instances of classes defined interactively can now be pickled (:ghissue:`29`;
244 243 :ghpull:`648`). Note that pickling saves a reference to the class definition,
245 244 so unpickling the instances will only work where the class has been defined.
246 245
247 246
248 247 Backwards incompatible changes
249 248 ------------------------------
250 249
251 250 * IPython connection information is no longer specified via ip/port directly,
252 251 rather via json connection files. These files are stored in the security
253 252 directory, and enable us to turn on HMAC message authentication by default,
254 253 significantly improving the security of kernels. Various utility functions
255 254 have been added to :mod:`IPython.lib.kernel`, for easier connecting to existing
256 255 kernels.
257 256
258 257 * :class:`~IPython.zmq.kernelmanager.KernelManager` now has one ip, and several
259 258 port traits, rather than several ip/port pair ``_addr`` traits. This better
260 259 matches the rest of the code, where the ip cannot not be set separately for
261 260 each channel.
262 261
263 262 * Custom prompts are now configured using a new class,
264 263 :class:`~IPython.core.prompts.PromptManager`, which has traits for
265 264 :attr:`in_template`, :attr:`in2_template` (the ``...:`` continuation prompt),
266 265 :attr:`out_template` and :attr:`rewrite_template`. This uses Python's string
267 266 formatting system, so you can use ``{time}`` and ``{cwd}``, although we have
268 267 preserved the abbreviations from previous versions, e.g. ``\#`` (prompt number)
269 268 and ``\w`` (working directory). For the list of available fields, refer to the
270 269 source of :file:`IPython/core/prompts.py`.
271 270
272 271 * The class inheritance of the Launchers in
273 272 :mod:`IPython.parallel.apps.launcher` used by ipcluster has changed, so that
274 273 trait names are more consistent across batch systems. This may require a few
275 274 renames in your config files, if you customized the command-line args for
276 275 launching controllers and engines. The configurable names have also been
277 276 changed to be clearer that they point to class names, and can now be
278 277 specified by name only, rather than requiring the full import path of each
279 278 class, e.g.::
280 279
281 280 IPClusterEngines.engine_launcher = 'IPython.parallel.apps.launcher.MPIExecEngineSetLauncher'
282 281 IPClusterStart.controller_launcher = 'IPython.parallel.apps.launcher.SSHControllerLauncher'
283 282
284 283 would now be specified as::
285 284
286 285 IPClusterEngines.engine_launcher_class = 'MPI'
287 286 IPClusterStart.controller_launcher_class = 'SSH'
288 287
289 288 The full path will still work, and is necessary for using custom launchers
290 289 not in IPython's launcher module.
291 290
292 291 Further, MPIExec launcher names are now prefixed with just MPI, to better match
293 292 other batch launchers, and be generally more intuitive. The MPIExec names are
294 293 deprecated, but continue to work.
295 294
296 295 * For embedding a shell, note that the parameters ``user_global_ns`` and
297 296 ``global_ns`` have been deprectated in favour of ``user_module`` and
298 297 ``module`` respsectively. The new parameters expect a module-like object,
299 298 rather than a namespace dict. The old parameters remain for backwards
300 299 compatibility, although ``user_global_ns`` is now ignored. The ``user_ns``
301 300 parameter works the same way as before, and calling
302 301 :func:`~IPython.frontend.terminal.embed.embed` with no arguments still works
303 302 as before.
304 303
305 304
306 305 Development summary and credits
307 306 -------------------------------
308 307
309 308 The previous version (IPython 0.11) was released on July 31 2011, so this
310 309 release cycle was roughly 4 1/2 months long, we closed a total of 515 issues,
311 310 257 pull requests and 258 regular issues (a :ref:`detailed list
312 311 <issues_list_012>` is available).
313 312
314 313 Many users and developers contributed code, features, bug reports and ideas to
315 314 this release. Please do not hesitate in contacting us if we've failed to
316 315 acknowledge your contribution here. In particular, for this release we have
317 316 had commits from the following 45 contributors, a mix of new and regular names
318 317 (in alphabetical order by first name):
319 318
320 319 * Alcides <alcides-at-do-not-span-me.com>
321 320 * Ben Edwards <bedwards-at-cs.unm.edu>
322 321 * Benjamin Ragan-Kelley <benjaminrk-at-gmail.com>
323 322 * Benjamin Thyreau <benjamin.thyreau-at-gmail.com>
324 323 * Bernardo B. Marques <bernardo.fire-at-gmail.com>
325 324 * Bernard Paulus <bprecyclebin-at-gmail.com>
326 325 * Bradley M. Froehle <brad.froehle-at-gmail.com>
327 326 * Brian E. Granger <ellisonbg-at-gmail.com>
328 327 * Christian Boos <cboos-at-bct-technology.com>
329 328 * Daniel Velkov <danielv-at-mylife.com>
330 329 * Erik Tollerud <erik.tollerud-at-gmail.com>
331 330 * Evan Patterson <epatters-at-enthought.com>
332 331 * Felix Werner <Felix.Werner-at-kit.edu>
333 332 * Fernando Perez <Fernando.Perez-at-berkeley.edu>
334 333 * Gabriel <g2p.code-at-gmail.com>
335 334 * Grahame Bowland <grahame-at-angrygoats.net>
336 335 * Hannes Schulz <schulz-at-ais.uni-bonn.de>
337 336 * Jens Hedegaard Nielsen <jenshnielsen-at-gmail.com>
338 337 * Jonathan March <jmarch-at-enthought.com>
339 338 * JΓΆrgen Stenarson <jorgen.stenarson-at-bostream.nu>
340 339 * Julian Taylor <jtaylor.debian-at-googlemail.com>
341 340 * Kefu Chai <tchaikov-at-gmail.com>
342 341 * macgyver <neil.rabinowitz-at-merton.ox.ac.uk>
343 342 * Matt Cottingham <matt.cottingham-at-gmail.com>
344 343 * Matthew Brett <matthew.brett-at-gmail.com>
345 344 * Matthias BUSSONNIER <bussonniermatthias-at-gmail.com>
346 345 * Michael Droettboom <mdboom-at-gmail.com>
347 346 * Nicolas Rougier <Nicolas.Rougier-at-inria.fr>
348 347 * Olivier Verdier <olivier.verdier-at-gmail.com>
349 348 * Omar Andres Zapata Mesa <andresete.chaos-at-gmail.com>
350 349 * Pablo Winant <pablo.winant-at-gmail.com>
351 350 * Paul Ivanov <pivanov314-at-gmail.com>
352 351 * Pauli Virtanen <pav-at-iki.fi>
353 352 * Pete Aykroyd <aykroyd-at-gmail.com>
354 353 * Prabhu Ramachandran <prabhu-at-enthought.com>
355 354 * Puneeth Chaganti <punchagan-at-gmail.com>
356 355 * Robert Kern <robert.kern-at-gmail.com>
357 356 * Satrajit Ghosh <satra-at-mit.edu>
358 357 * Stefan van der Walt <stefan-at-sun.ac.za>
359 358 * Szabolcs HorvΓ‘t <szhorvat-at-gmail.com>
360 359 * Thomas Kluyver <takowl-at-gmail.com>
361 360 * Thomas Spura <thomas.spura-at-gmail.com>
362 361 * Timo Paulssen <timonator-at-perpetuum-immobile.de>
363 362 * Valentin Haenel <valentin.haenel-at-gmx.de>
364 363 * Yaroslav Halchenko <debian-at-onerussian.com>
365 364
366 365 .. note::
367 366
368 367 This list was generated with the output of
369 368 ``git log rel-0.11..HEAD --format='* %aN <%aE>' | sed 's/@/\-at\-/' | sed 's/<>//' | sort -u``
370 369 after some cleanup. If you should be on this list, please add yourself.
@@ -1,306 +1,302 b''
1 1 ============
2 2 1.0 Series
3 3 ============
4 4
5 5 Release 1.0.0: An Afternoon Hack
6 6 ================================
7 7
8 8
9 9 IPython 1.0 requires Python β‰₯ 2.6.5 or β‰₯ 3.2.1.
10 10 It does not support Python 3.0, 3.1, or 2.5.
11 11
12 12 This is a big release. The principal milestone is the addition of :mod:`IPython.nbconvert`,
13 13 but there has been a great deal of work improving all parts of IPython as well.
14 14
15 15 The previous version (0.13) was released on June 30, 2012,
16 16 and in this development cycle we had:
17 17
18 18 - ~12 months of work.
19 19 - ~700 pull requests merged.
20 20 - ~600 issues closed (non-pull requests).
21 21 - contributions from ~150 authors.
22 22 - ~4000 commits.
23 23
24 24 The amount of work included in this release is so large that we can only cover
25 25 here the main highlights; please see our :ref:`detailed release statistics
26 26 <issues_list_100>` for links to every issue and pull request closed on GitHub
27 27 as well as a full list of individual contributors.
28 28 It includes
29 29
30 30 Reorganization
31 31 --------------
32 32
33 33 There have been two major reorganizations in IPython 1.0:
34 34
35 35 - Added :mod:`IPython.kernel` for all kernel-related code.
36 36 This means that :mod:`IPython.zmq` has been removed,
37 37 and much of it is now in :mod:`IPython.kernel.zmq`,
38 38 some of it being in the top-level :mod:`IPython.kernel`.
39 39 - We have removed the `frontend` subpackage,
40 40 as it caused unnecessary depth. So what was :mod:`IPython.frontend.qt`
41 41 is now :mod:`IPython.qt`, and so on. The one difference is that
42 42 the notebook has been further flattened, so that
43 43 :mod:`IPython.frontend.html.notebook` is now just `IPython.html`.
44 44 There is a shim module, so :mod:`IPython.frontend` is still
45 45 importable in 1.0, but there will be a warning.
46 46 - The IPython sphinx directives are now installed in :mod:`IPython.sphinx`,
47 47 so they can be imported by other projects.
48 48
49 49
50 50 Public APIs
51 51 -----------
52 52
53 53 For the first time since 0.10 (sorry, everyone),
54 54 there is an official public API for starting IPython:
55 55
56 56 .. sourcecode:: python
57 57
58 58 from IPython import start_ipython
59 59 start_ipython()
60 60
61 61 This is what packages should use that start their own IPython session,
62 62 but don't actually want embedded IPython (most cases).
63 63 :func:`IPython.embed()` is used for embedding IPython into the calling namespace,
64 64 similar to calling :func:`Pdb.set_trace`, whereas :func:`start_ipython`
65 65 will start a plain IPython session, loading config and startup files as normal.
66 66
67 67 We also have added:
68 68
69 69 .. sourcecode:: python
70 70
71 71 from IPython import get_ipython
72 72
73 73
74 74 Which is a *library* function for getting the current IPython instance,
75 75 and will return ``None`` if no IPython instance is running.
76 76 This is the official way to check whether your code is called from inside an IPython session.
77 77 If you want to check for IPython without unnecessarily importing IPython,
78 78 use this function:
79 79
80 80 .. sourcecode:: python
81 81
82 82 def get_ipython():
83 83 """return IPython instance if there is one, None otherwise"""
84 84 import sys
85 85 if "IPython" in sys.modules:
86 86 import IPython
87 87 return IPython.get_ipython()
88 88
89 89 Core
90 90 ----
91 91
92 92 - The input transformation framework has been reworked. This fixes some corner
93 93 cases, and adds more flexibility for projects which use IPython, like SymPy &
94 94 SAGE. For more details, see :doc:`/config/inputtransforms`.
95 95 - Exception types can now be displayed with a custom traceback, by defining a
96 96 ``_render_traceback_()`` method which returns a list of strings, each
97 97 containing one line of the traceback.
98 98 - A new command, ``ipython history trim`` can be used to delete everything but
99 99 the last 1000 entries in the history database.
100 100 - ``__file__`` is defined in both config files at load time,
101 101 and ``.ipy`` files executed with ``%run``.
102 102 - ``%logstart`` and ``%logappend`` are no longer broken.
103 103 - Add glob expansion for ``%run``, e.g. ``%run -g script.py *.txt``.
104 104 - Expand variables (``$foo``) in Cell Magic argument line.
105 105 - By default, :command:`iptest` will exclude various slow tests.
106 106 All tests can be run with :command:`iptest --all`.
107 107 - SQLite history can be disabled in the various cases that it does not behave well.
108 108 - ``%edit`` works on interactively defined variables.
109 109 - editor hooks have been restored from quarantine, enabling TextMate as editor,
110 110 etc.
111 111 - The env variable PYTHONSTARTUP is respected by IPython.
112 112 - The ``%matplotlib`` magic was added, which is like the old ``%pylab`` magic,
113 113 but it does not import anything to the interactive namespace.
114 114 It is recommended that users switch to ``%matplotlib`` and explicit imports.
115 115 - The ``--matplotlib`` command line flag was also added. It invokes the new
116 116 ``%matplotlib`` magic and can be used in the same way as the old ``--pylab``
117 117 flag. You can either use it by itself as a flag (``--matplotlib``), or you
118 118 can also pass a backend explicitly (``--matplotlib qt`` or
119 119 ``--matplotlib=wx``, etc).
120 120
121 121
122 122 Backwards incompatible changes
123 123 ******************************
124 124
125 125 - Calling :meth:`InteractiveShell.prefilter` will no longer perform static
126 126 transformations - the processing of escaped commands such as ``%magic`` and
127 127 ``!system``, and stripping input prompts from code blocks. This functionality
128 128 was duplicated in :mod:`IPython.core.inputsplitter`, and the latter version
129 129 was already what IPython relied on. A new API to transform input will be ready
130 130 before release.
131 131 - Functions from :mod:`IPython.lib.inputhook` to control integration with GUI
132 132 event loops are no longer exposed in the top level of :mod:`IPython.lib`.
133 133 Code calling these should make sure to import them from
134 134 :mod:`IPython.lib.inputhook`.
135 135 - For all kernel managers, the ``sub_channel`` attribute has been renamed to
136 136 ``iopub_channel``.
137 137 - Users on Python versions before 2.6.6, 2.7.1 or 3.2 will now need to call
138 138 :func:`IPython.utils.doctestreload.doctest_reload` to make doctests run
139 139 correctly inside IPython. Python releases since those versions are unaffected.
140 140 For details, see :ghpull:`3068` and `Python issue 8048 <http://bugs.python.org/issue8048>`_.
141 141 - The ``InteractiveShell.cache_main_mod()`` method has been removed, and
142 142 :meth:`~IPython.core.interactiveshell.InteractiveShell.new_main_mod` has a
143 143 different signature, expecting a filename where earlier versions expected
144 144 a namespace. See :ghpull:`3555` for details.
145 145 - The short-lived plugin system has been removed. Extensions are the way to go.
146 146
147 147
148 148 .. _nbconvert1:
149 149
150 150 NbConvert
151 151 ---------
152 152
153 153 The major milestone for IPython 1.0 is the addition of :mod:`IPython.nbconvert` - tools for converting
154 154 IPython notebooks to various other formats.
155 155
156 156 .. warning::
157 157
158 158 nbconvert is Ξ±-level preview code in 1.0
159 159
160 160 To use nbconvert to convert various file formats::
161 161
162 162 ipython nbconvert --to html *.ipynb
163 163
164 164 See ``ipython nbconvert --help`` for more information.
165 165 nbconvert depends on `pandoc`_ for many of the translations to and from various formats.
166 166
167 .. seealso::
168
169 :ref:`nbconvert`
170
171 167 .. _pandoc: http://johnmacfarlane.net/pandoc/
172 168
173 169 Notebook
174 170 --------
175 171
176 172 Major changes to the IPython Notebook in 1.0:
177 173
178 174 - The notebook is now autosaved, by default at an interval of two minutes.
179 175 When you press 'save' or Ctrl-S, a *checkpoint* is made, in a hidden folder.
180 176 This checkpoint can be restored, so that the autosave model is strictly safer
181 177 than traditional save. If you change nothing about your save habits,
182 178 you will always have a checkpoint that you have written,
183 179 and an autosaved file that is kept up to date.
184 180 - The notebook supports :func:`raw_input` / :func:`input`, and thus also ``%debug``,
185 181 and many other Python calls that expect user input.
186 182 - You can load custom javascript and CSS in the notebook by editing the files
187 183 :file:`$(ipython locate profile)/static/custom/custom.{js,css}`.
188 184 - Add ``%%html``, ``%%svg``, ``%%javascript``, and ``%%latex`` cell magics
189 185 for writing raw output in notebook cells.
190 186 - add a redirect handler and anchors on heading cells, so you can link
191 187 across notebooks, directly to heading cells in other notebooks.
192 188 - Images support width and height metadata,
193 189 and thereby 2x scaling (retina support).
194 190 - ``_repr_foo_`` methods can return a tuple of (data, metadata),
195 191 where metadata is a dict containing metadata about the displayed object.
196 192 This is used to set size, etc. for retina graphics. To enable retina matplotlib figures,
197 193 simply set ``InlineBackend.figure_format = 'retina'`` for 2x PNG figures,
198 194 in your :ref:`IPython config file <config_overview>` or via the ``%config`` magic.
199 195 - Add display.FileLink and FileLinks for quickly displaying HTML links to local files.
200 196 - Cells have metadata, which can be edited via cell toolbars.
201 197 This metadata can be used by external code (e.g. reveal.js or exporters),
202 198 when examining the notebook.
203 199 - Fix an issue parsing LaTeX in markdown cells, which required users to type ``\\\``,
204 200 instead of ``\\``.
205 201 - Notebook templates are rendered with Jinja instead of Tornado.
206 202 - ``%%file`` has been renamed ``%%writefile`` (``%%file`` is deprecated).
207 203 - ANSI (and VT100) color parsing has been improved in both performance and
208 204 supported values.
209 205 - The static files path can be found as ``IPython.html.DEFAULT_STATIC_FILES_PATH``,
210 206 which may be changed by package managers.
211 207 - IPython's CSS is installed in :file:`static/css/style.min.css`
212 208 (all style, including bootstrap), and :file:`static/css/ipython.min.css`,
213 209 which only has IPython's own CSS. The latter file should be useful for embedding
214 210 IPython notebooks in other pages, blogs, etc.
215 211 - The Print View has been removed. Users are encouraged to test :ref:`ipython
216 212 nbconvert <nbconvert1>` to generate a static view.
217 213
218 214 Javascript Components
219 215 *********************
220 216
221 217 The javascript components used in the notebook have been updated significantly.
222 218
223 219 - updates to jQuery (2.0) and jQueryUI (1.10)
224 220 - Update CodeMirror to 3.14
225 221 - Twitter Bootstrap (2.3) for layout
226 222 - Font-Awesome (3.1) for icons
227 223 - highlight.js (7.3) for syntax highlighting
228 224 - marked (0.2.8) for markdown rendering
229 225 - require.js (2.1) for loading javascript
230 226
231 227 Some relevant changes that are results of this:
232 228
233 229 - Markdown cells now support GitHub-flavored Markdown (GFM),
234 230 which includes `````python`` code blocks and tables.
235 231 - Notebook UI behaves better on more screen sizes.
236 232 - Various code cell input issues have been fixed.
237 233
238 234
239 235 Kernel
240 236 ------
241 237
242 238 The kernel code has been substantially reorganized.
243 239
244 240 New features in the kernel:
245 241
246 242 - Kernels support ZeroMQ IPC transport, not just TCP
247 243 - The message protocol has added a top-level metadata field,
248 244 used for information about messages.
249 245 - Add a `data_pub` message that functions much like `display_pub`,
250 246 but publishes raw (usually pickled) data, rather than representations.
251 247 - Ensure that ``sys.stdout.encoding`` is defined in Kernels.
252 248 - Stdout from forked subprocesses should be forwarded to frontends (instead of crashing).
253 249
254 250 IPEP 13
255 251 *******
256 252
257 253 The KernelManager has been split into a :class:`~.KernelManager` and a :class:`~.KernelClient`.
258 254 The Manager owns a kernel and starts / signals / restarts it. There is always zero or one
259 255 KernelManager per Kernel. Clients communicate with Kernels via zmq channels,
260 256 and there can be zero-to-many Clients connected to a Kernel at any given time.
261 257
262 258 The KernelManager now automatically restarts the kernel when it dies,
263 259 rather than requiring user input at the notebook or QtConsole UI
264 260 (which may or may not exist at restart time).
265 261
266 262 In-process kernels
267 263 ******************
268 264
269 265 The Python-language frontends, particularly the Qt console, may now communicate
270 266 with in-process kernels, in addition to the traditional out-of-process
271 267 kernels. An in-process kernel permits direct access to the kernel namespace,
272 268 which is necessary in some applications. It should be understood, however, that
273 269 the in-process kernel is not robust to bad user input and will block the main
274 270 (GUI) thread while executing. Developers must decide on a case-by-case basis
275 271 whether this tradeoff is appropriate for their application.
276 272
277 273
278 274
279 275 Parallel
280 276 --------
281 277
282 278 IPython.parallel has had some refactoring as well.
283 279 There are many improvements and fixes, but these are the major changes:
284 280
285 281 - Connections have been simplified. All ports and the serialization in use
286 282 are written to the connection file, rather than the initial two-stage system.
287 283 - Serialization has been rewritten, fixing many bugs and dramatically improving
288 284 performance serializing large containers.
289 285 - Load-balancing scheduler performance with large numbers of tasks has been dramatically improved.
290 286 - There should be fewer (hopefully zero) false-positives for engine failures.
291 287 - Increased compatibility with various use cases that produced serialization / argument errors
292 288 with map, etc.
293 289 - The controller can attempt to resume operation if it has crashed,
294 290 by passing ``ipcontroller --restore``.
295 291 - Engines can monitor the Hub heartbeat, and shutdown if the Hub disappears for too long.
296 292 - add HTCondor support in launchers
297 293
298 294
299 295 QtConsole
300 296 ---------
301 297
302 298 Various fixes, including improved performance with lots of text output,
303 299 and better drag and drop support.
304 300 The initial window size of the qtconsole is now configurable via ``IPythonWidget.width``
305 301 and ``IPythonWidget.height``.
306 302
@@ -1,384 +1,384 b''
1 1 ============
2 2 2.x Series
3 3 ============
4 4
5 5 Release 2.4
6 6 ===========
7 7
8 8 January, 2014
9 9
10 10 .. note::
11 11
12 12 Some of the patches marked for 2.4 were left out of 2.4.0.
13 13 Please use 2.4.1.
14 14
15 15 - backport read support for nbformat v4 from IPython 3
16 16 - support for PyQt5 in the kernel (not QtConsole)
17 17 - support for Pygments 2.0
18 18
19 19 For more information on what fixes have been backported to 2.4,
20 20 see our :ref:`detailed release info <issues_list_200>`.
21 21
22 22
23 23 Release 2.3.1
24 24 =============
25 25
26 26 November, 2014
27 27
28 28 - Fix CRCRLF line-ending bug in notebooks on Windows
29 29
30 30 For more information on what fixes have been backported to 2.3.1,
31 31 see our :ref:`detailed release info <issues_list_200>`.
32 32
33 33 Release 2.3.0
34 34 =============
35 35
36 36 October, 2014
37 37
38 38 - improve qt5 support
39 39 - prevent notebook data loss with atomic writes
40 40
41 41 For more information on what fixes have been backported to 2.3,
42 42 see our :ref:`detailed release info <issues_list_200>`.
43 43
44 44 Release 2.2.0
45 45 =============
46 46
47 47 August, 2014
48 48
49 49 - Add CORS configuration
50 50
51 51 For more information on what fixes have been backported to 2.2,
52 52 see our :ref:`detailed release info <issues_list_200>`.
53 53
54 54 Release 2.1.0
55 55 =============
56 56
57 57 May, 2014
58 58
59 59 IPython 2.1 is the first bugfix release for 2.0.
60 60 For more information on what fixes have been backported to 2.1,
61 61 see our :ref:`detailed release info
62 62 <issues_list_200>`.
63 63
64 64
65 65 Release 2.0.0
66 66 =============
67 67
68 68 April, 2014
69 69
70 70 IPython 2.0 requires Python β‰₯ 2.7.2 or β‰₯ 3.3.0.
71 71 It does not support Python 3.0, 3.1, 3.2, 2.5, or 2.6.
72 72
73 73 The principal milestones of 2.0 are:
74 74
75 75 - interactive widgets for the notebook
76 76 - directory navigation in the notebook dashboard
77 77 - persistent URLs for notebooks
78 78 - a new modal user interface in the notebook
79 79 - a security model for notebooks
80 80
81 81 Contribution summary since IPython 1.0 in August, 2013:
82 82
83 83 - ~8 months of work
84 84 - ~650 pull requests merged
85 85 - ~400 issues closed (non-pull requests)
86 86 - contributions from ~100 authors
87 87 - ~4000 commits
88 88
89 89 The amount of work included in this release is so large that we can only cover
90 90 here the main highlights; please see our :ref:`detailed release statistics
91 91 <issues_list_200>` for links to every issue and pull request closed on GitHub
92 92 as well as a full list of individual contributors.
93 93
94 94 New stuff in the IPython notebook
95 95 ---------------------------------
96 96
97 97 Directory navigation
98 98 ********************
99 99
100 100 .. image:: /_images/2.0/treeview.png
101 101 :width: 392px
102 102 :alt: Directory navigation
103 103 :align: center
104 104
105 105 The IPython notebook dashboard allows navigation into subdirectories.
106 106 URLs are persistent based on the notebook's path and name,
107 107 so no more random UUID URLs.
108 108
109 109 Serving local files no longer needs the ``files/`` prefix.
110 110 Relative links across notebooks and other files should work just as if notebooks were regular HTML files.
111 111
112 112 Interactive widgets
113 113 *******************
114 114
115 115 .. image:: /_images/2.0/widgets.png
116 116 :width: 392px
117 117 :alt: Interactive widgets
118 118 :align: center
119 119
120 120 IPython 2.0 adds :mod:`IPython.html.widgets`, for manipulating
121 121 Python objects in the kernel with GUI controls in the notebook.
122 122 IPython comes with a few built-in widgets for simple data types,
123 123 and an API designed for developers to build more complex widgets.
124 124 See the `widget docs`_ for more information.
125 125
126 126 .. _widget docs: http://nbviewer.ipython.org/github/ipython/ipython/blob/2.x/examples/Interactive%20Widgets/Index.ipynb
127 127
128 128
129 129 Modal user interface
130 130 ********************
131 131
132 132 The notebook has added separate Edit and Command modes,
133 133 allowing easier keyboard commands and making keyboard shortcut customization possible.
134 134 See the new `User Interface notebook`_ for more information.
135 135
136 136 .. _User Interface Notebook: http://nbviewer.ipython.org/github/ipython/ipython/blob/2.x/examples/Notebook/User%20Interface.ipynb
137 137
138 138
139 139 You can familiarize yourself with the updated notebook user interface, including an
140 140 explanation of Edit and Command modes, by going through the short guided tour
141 141 which can be started from the Help menu.
142 142
143 143 .. image:: /_images/2.0/user-interface.png
144 144 :width: 392px
145 145 :alt: Interface tour
146 146 :align: center
147 147
148 148
149 149 Security
150 150 ********
151 151
152 2.0 introduces a :ref:`security model <notebook_security>` for notebooks,
152 2.0 introduces a security model for notebooks,
153 153 to prevent untrusted code from executing on users' behalf when notebooks open.
154 154 A quick summary of the model:
155 155
156 - Trust is determined by :ref:`signing notebooks<signing_notebooks>`.
156 - Trust is determined by signing notebooks.
157 157 - Untrusted HTML output is sanitized.
158 158 - Untrusted Javascript is never executed.
159 159 - HTML and Javascript in Markdown are never trusted.
160 160
161 161 Dashboard "Running" tab
162 162 ***********************
163 163
164 164 .. image:: /_images/2.0/running-crop.png
165 165 :width: 392px
166 166 :alt: Running tab
167 167 :align: center
168 168
169 169 The dashboard now has a "Running" tab which shows all of the running notebooks.
170 170
171 171 Single codebase Python 3 support
172 172 --------------------------------
173 173
174 174 IPython previously supported Python 3 by running 2to3 during setup. We
175 175 have now switched to a single codebase which runs natively on Python 2.7
176 176 and 3.3.
177 177
178 178 For notes on how to maintain this, see :doc:`/development/pycompat`.
179 179
180 180 Selecting matplotlib figure formats
181 181 -----------------------------------
182 182
183 183 Deprecate single-format ``InlineBackend.figure_format``
184 184 configurable in favor of ``InlineBackend.figure_formats``,
185 185 which is a set, supporting multiple simultaneous figure formats (e.g. png, pdf).
186 186
187 187 This is available at runtime with the new API function :func:`IPython.display.set_matplotlib_formats`.
188 188
189 189 clear_output changes
190 190 --------------------
191 191
192 192 * There is no longer a 500ms delay when calling ``clear_output``.
193 193 * The ability to clear stderr and stdout individually was removed.
194 194 * A new ``wait`` flag that prevents ``clear_output`` from being executed until new
195 195 output is available. This eliminates animation flickering by allowing the
196 196 user to double buffer the output.
197 197 * The output div height is remembered when the ``wait=True`` flag is used.
198 198
199 199 Extending configurable containers
200 200 ---------------------------------
201 201
202 202 Some configurable traits are containers (list, dict, set)
203 203 Config objects now support calling ``extend``, ``update``, ``insert``, etc.
204 204 on traits in config files, which will ultimately result in calling
205 205 those methods on the original object.
206 206
207 207 The effect being that you can now add to containers without having to copy/paste
208 208 the initial value::
209 209
210 210 c = get_config()
211 211 c.InlineBackend.rc.update({ 'figure.figsize' : (6, 4) })
212 212
213 213 Changes to hidden namespace on startup
214 214 --------------------------------------
215 215
216 216 Previously, all names declared in code run at startup
217 217 (startup files, ``ipython -i script.py``, etc.)
218 218 were added to the hidden namespace, which hides the names from tools like ``%whos``.
219 219 There are two changes to this behavior:
220 220
221 221 1. Scripts run on the command-line ``ipython -i script.py``now behave the same as if they were
222 222 passed to ``%run``, so their variables are never hidden.
223 223 2. A boolean config flag ``InteractiveShellApp.hide_initial_ns`` has been added to optionally
224 224 disable the hidden behavior altogether. The default behavior is unchanged.
225 225
226 226 Using dill to expand serialization support
227 227 ------------------------------------------
228 228
229 229 The new function :func:`~IPython.utils.pickleutil.use_dill` allows
230 230 dill to extend serialization support in :mod:`IPython.parallel` (closures, etc.).
231 231 A :meth:`DirectView.use_dill` convenience method was also added, to enable dill
232 232 locally and on all engines with one call.
233 233
234 234 New IPython console lexer
235 235 -------------------------
236 236
237 237 The IPython console lexer has been rewritten and now supports tracebacks
238 238 and customized input/output prompts. See the :ref:`new lexer docs <console_lexer>`
239 239 for details.
240 240
241 241 DisplayFormatter changes
242 242 ------------------------
243 243
244 244 There was no official way to query or remove callbacks in the Formatter API.
245 245 To remedy this, the following methods are added to :class:`BaseFormatter`:
246 246
247 247 - ``lookup(instance)`` - return appropriate callback or a given object
248 248 - ``lookup_by_type(type_or_str)`` - return appropriate callback for a given type or ``'mod.name'`` type string
249 249 - ``pop(type_or_str)`` - remove a type (by type or string).
250 250 Pass a second argument to avoid KeyError (like dict).
251 251
252 252 All of the above methods raise a KeyError if no match is found.
253 253
254 254 And the following methods are changed:
255 255
256 256 - ``for_type(type_or_str)`` - behaves the same as before, only adding support for ``'mod.name'``
257 257 type strings in addition to plain types. This removes the need for ``for_type_by_name()``,
258 258 but it remains for backward compatibility.
259 259
260 260 Formatters can now raise NotImplementedError in addition to returning None
261 261 to indicate that they cannot format a given object.
262 262
263 263 Exceptions and Warnings
264 264 ***********************
265 265
266 266 Exceptions are no longer silenced when formatters fail.
267 267 Instead, these are turned into a :class:`~IPython.core.formatters.FormatterWarning`.
268 268 A FormatterWarning will also be issued if a formatter returns data of an invalid type
269 269 (e.g. an integer for 'image/png').
270 270
271 271
272 272 Other changes
273 273 -------------
274 274
275 275 * `%%capture` cell magic now captures the rich display output, not just
276 276 stdout/stderr
277 277
278 278 * In notebook, Showing tooltip on tab has been disables to avoid conflict with
279 279 completion, Shift-Tab could still be used to invoke tooltip when inside
280 280 function signature and/or on selection.
281 281
282 282 * ``object_info_request`` has been replaced by ``object_info`` for consistency in the javascript API.
283 283 ``object_info`` is a simpler interface to register callback that is incompatible with ``object_info_request``.
284 284
285 285 * Previous versions of IPython on Linux would use the XDG config directory,
286 286 creating :file:`~/.config/ipython` by default. We have decided to go
287 287 back to :file:`~/.ipython` for consistency among systems. IPython will
288 288 issue a warning if it finds the XDG location, and will move it to the new
289 289 location if there isn't already a directory there.
290 290
291 291 * Equations, images and tables are now centered in Markdown cells.
292 292 * Multiline equations are now centered in output areas; single line equations
293 293 remain left justified.
294 294
295 295 * IPython config objects can be loaded from and serialized to JSON.
296 296 JSON config file have the same base name as their ``.py`` counterpart,
297 297 and will be loaded with higher priority if found.
298 298
299 299 * bash completion updated with support for all ipython subcommands and flags, including nbconvert
300 300
301 301 * ``ipython history trim``: added ``--keep=<N>`` as an alias for the more verbose
302 302 ``--HistoryTrim.keep=<N>``
303 303 * New ``ipython history clear`` subcommand, which is the same as the newly supported
304 304 ``ipython history trim --keep=0``
305 305
306 306 * You can now run notebooks in an interactive session via ``%run notebook.ipynb``.
307 307
308 308 * Print preview is back in the notebook menus, along with options to
309 309 download the open notebook in various formats. This is powered by
310 310 nbconvert.
311 311
312 312 * :exc:`~IPython.nbconvert.utils.pandoc.PandocMissing` exceptions will be
313 313 raised if Pandoc is unavailable, and warnings will be printed if the version
314 314 found is too old. The recommended Pandoc version for use with nbconvert is
315 315 1.12.1.
316 316
317 317 * The InlineBackend.figure_format now supports JPEG output if PIL/Pillow is available.
318 318
319 319 * Input transformers (see :doc:`/config/inputtransforms`) may now raise
320 320 :exc:`SyntaxError` if they determine that input is invalid. The input
321 321 transformation machinery in IPython will handle displaying the exception to
322 322 the user and resetting state.
323 323
324 324 * Calling ``container.show()`` on javascript display is deprecated and will
325 325 trigger errors on future IPython notebook versions. ``container`` now show
326 326 itself as soon as non-empty
327 327
328 328 * Added ``InlineBackend.print_figure_kwargs`` to allow passing keyword arguments
329 329 to matplotlib's ``Canvas.print_figure``. This can be used to change the value of
330 330 ``bbox_inches``, which is 'tight' by default, or set the quality of JPEG figures.
331 331
332 332 * A new callback system has been introduced. For details, see :doc:`/config/callbacks`.
333 333
334 334 * jQuery and require.js are loaded from CDNs in the default HTML template,
335 335 so javascript is available in static HTML export (e.g. nbviewer).
336 336
337 337 Backwards incompatible changes
338 338 ------------------------------
339 339
340 340 * Python 2.6 and 3.2 are no longer supported: the minimum required
341 341 Python versions are now 2.7 and 3.3.
342 342 * The Transformer classes have been renamed to Preprocessor in nbconvert and
343 343 their ``call`` methods have been renamed to ``preprocess``.
344 344 * The ``call`` methods of nbconvert post-processsors have been renamed to
345 345 ``postprocess``.
346 346
347 347 * The module ``IPython.core.fakemodule`` has been removed.
348 348
349 349 * The alias system has been reimplemented to use magic functions. There should be little
350 350 visible difference while automagics are enabled, as they are by default, but parts of the
351 351 :class:`~IPython.core.alias.AliasManager` API have been removed.
352 352
353 353 * We fixed an issue with switching between matplotlib inline and GUI backends,
354 354 but the fix requires matplotlib 1.1 or newer. So from now on, we consider
355 355 matplotlib 1.1 to be the minimally supported version for IPython. Older
356 356 versions for the most part will work, but we make no guarantees about it.
357 357
358 358 * The :command:`pycolor` command has been removed. We recommend the much more capable
359 359 :command:`pygmentize` command from the `Pygments <http://pygments.org/>`_ project.
360 360 If you need to keep the exact output of :command:`pycolor`, you can still use
361 361 ``python -m IPython.utils.PyColorize foo.py``.
362 362
363 363 * :mod:`IPython.lib.irunner` and its command-line entry point have been removed.
364 364 It had fallen out of use long ago.
365 365
366 366 * The ``input_prefilter`` hook has been removed, as it was never
367 367 actually used by the code. The input transformer system offers much
368 368 more powerful APIs to work with input code. See
369 369 :doc:`/config/inputtransforms` for details.
370 370
371 371 * :class:`IPython.core.inputsplitter.IPythonInputSplitter` no longer has a method
372 372 ``source_raw_reset()``, but gains :meth:`~IPython.core.inputsplitter.IPythonInputSplitter.raw_reset`
373 373 instead. Use of ``source_raw_reset`` can be replaced with::
374 374
375 375 raw = isp.source_raw
376 376 transformed = isp.source_reset()
377 377
378 378 * The Azure notebook manager was removed as it was no longer compatible with the notebook storage scheme.
379 379
380 380 * Simplifying configurable URLs
381 381
382 382 - base_project_url is renamed to base_url (base_project_url is kept as a deprecated alias, for now)
383 383 - base_kernel_url configurable is removed (use base_url)
384 384 - websocket_url configurable is removed (use base_url)
@@ -1,391 +1,391 b''
1 1 ============
2 2 3.x Series
3 3 ============
4 4
5 5 IPython 3.2.3
6 6 =============
7 7
8 8 Fixes compatibility with Python 3.4.4.
9 9
10 10 IPython 3.2.2
11 11 =============
12 12
13 13 Address vulnerabilities when files have maliciously crafted filenames (CVE-2015-6938),
14 14 or vulnerability when opening text files with malicious binary content (CVE pending).
15 15
16 16 Users are **strongly** encouraged to upgrade immediately.
17 17 There are also a few small unicode and nbconvert-related fixes.
18 18
19 19
20 20 IPython 3.2.1
21 21 =============
22 22
23 23 IPython 3.2.1 is a small bugfix release, primarily for cross-site security fixes in the notebook.
24 24 Users are **strongly** encouraged to upgrade immediately.
25 25 There are also a few small unicode and nbconvert-related fixes.
26 26
27 27 See :ref:`issues_list_3` for details.
28 28
29 29
30 30 IPython 3.2
31 31 ===========
32 32
33 33 IPython 3.2 contains important security fixes. Users are **strongly** encouraged to upgrade immediately.
34 34
35 35 Highlights:
36 36
37 37 - Address cross-site scripting vulnerabilities CVE-2015-4706, CVE-2015-4707
38 38 - A security improvement that set the secure attribute to login cookie to prevent them to be sent over http
39 39 - Revert the face color of matplotlib axes in the inline backend to not be transparent.
40 40 - Enable mathjax safe mode by default
41 41 - Fix XSS vulnerability in JSON error messages
42 42 - Various widget-related fixes
43 43
44 44 See :ref:`issues_list_3` for details.
45 45
46 46
47 47 IPython 3.1
48 48 ===========
49 49
50 50 Released April 3, 2015
51 51
52 52 The first 3.x bugfix release, with 33 contributors and 344 commits.
53 53 This primarily includes bugfixes to notebook layout and focus problems.
54 54
55 55
56 56 Highlights:
57 57
58 58 - Various focus jumping and scrolling fixes in the notebook.
59 59 - Various message ordering and widget fixes in the notebook.
60 60 - Images in markdown and output are confined to the notebook width.
61 61 An `.unconfined` CSS class is added to disable this behavior per-image.
62 62 The resize handle on output images is removed.
63 63 - Improved ordering of tooltip content for Python functions, putting the signature at the top.
64 64 - Fix UnicodeErrors when displaying some objects with unicode reprs on Python 2.
65 65 - Set the kernel's working directory to the notebook directory when running ``nbconvert --execute``,
66 66 so that behavior matches the live notebook.
67 67 - Allow setting custom SSL options for the tornado server with ``NotebookApp.ssl_options``,
68 68 and protect against POODLE with default settings by disabling SSLv3.
69 69 - Fix memory leak in the IPython.parallel Controller on Python 3.
70 70
71 71
72 72 See :ref:`issues_list_3` for details.
73 73
74 74
75 75 Release 3.0
76 76 ===========
77 77
78 78 Released February 27, 2015
79 79
80 80 This is a really big release. Over 150 contributors, and almost 6000 commits in a bit under a year.
81 81 Support for languages other than Python is greatly improved,
82 82 notebook UI has been significantly redesigned,
83 83 and a lot of improvement has happened in the experimental interactive widgets.
84 84 The message protocol and document format have both been updated,
85 85 while maintaining better compatibility with previous versions than prior updates.
86 86 The notebook webapp now enables editing of any text file, and even
87 87 a web-based terminal (on Unix platforms).
88 88
89 89 3.x will be the last monolithic release of IPython,
90 90 as the next release cycle will see the growing project split into its Python-specific and language-agnostic components.
91 91 Language-agnostic projects (notebook, qtconsole, etc.) will move under the umbrella of the new Project Jupyter name,
92 92 while Python-specific projects (interactive Python shell, Python kernel, IPython.parallel)
93 93 will remain under IPython, and be split into a few smaller packages.
94 94 To reflect this, IPython is in a bit of a transition state.
95 95 The logo on the notebook is now the Jupyter logo.
96 96 When installing kernels system-wide, they go in a `jupyter` directory.
97 97 We are going to do our best to ease this transition for users and developers.
98 98
99 99 Big changes are ahead.
100 100
101 101
102 102 Using different kernels
103 103 -----------------------
104 104
105 105 .. image:: ../_images/kernel_selector_screenshot.png
106 106 :alt: Screenshot of 'new' dropdown showing different kernels
107 107 :align: center
108 108
109 109 You can now choose a kernel for a notebook within the user interface, rather
110 110 than starting up a separate notebook server for each kernel you want to use. The
111 111 syntax highlighting adapts to match the language you're working in.
112 112
113 113 Information about the kernel is stored in the notebook file, so when you open a
114 114 notebook, it will automatically start the correct kernel.
115 115
116 116 It is also easier to use the Qt console and the terminal console with other
117 117 kernels, using the --kernel flag::
118 118
119 119 ipython qtconsole --kernel bash
120 120 ipython console --kernel bash
121 121
122 122 # To list available kernels
123 123 ipython kernelspec list
124 124
125 125 Kernel authors should see :ref:`kernelspecs` for how to register their kernels
126 126 with IPython so that these mechanisms work.
127 127
128 128 Typing unicode identifiers
129 129 --------------------------
130 130
131 131 .. image:: /_images/unicode_completion.png
132 132
133 133 Complex expressions can be much cleaner when written with a wider choice of
134 134 characters. Python 3 allows unicode identifiers, and IPython 3 makes it easier
135 135 to type those, using a feature from Julia. Type a backslash followed by a LaTeX
136 136 style short name, such as ``\alpha``. Press tab, and it will turn into Ξ±.
137 137
138 138 Widget migration guide
139 139 ----------------------
140 140 The widget framework has a lot of backwards incompatible changes.
141 141 For information about migrating widget notebooks and custom widgets to 3.0 refer
142 142 to the :doc:`widget migration guide<version3_widget_migration>`.
143 143
144 144 Other new features
145 145 ------------------
146 146
147 147 * :class:`~.TextWidget` and :class:`~.TextareaWidget` objects now include a
148 148 ``placeholder`` attribute, for displaying placeholder text before the
149 149 user has typed anything.
150 150
151 151 * The :magic:`load` magic can now find the source for objects in the user namespace.
152 152 To enable searching the namespace, use the ``-n`` option.
153 153
154 154 .. sourcecode:: ipython
155 155
156 156 In [1]: %load -n my_module.some_function
157 157
158 158 * :class:`~.DirectView` objects have a new :meth:`~.DirectView.use_cloudpickle`
159 159 method, which works like ``view.use_dill()``, but causes the ``cloudpickle``
160 160 module from PiCloud's `cloud`__ library to be used rather than dill or the
161 161 builtin pickle module.
162 162
163 163 __ https://pypi.python.org/pypi/cloud
164 164
165 165 * Added a .ipynb exporter to nbconvert. It can be used by passing `--to notebook`
166 166 as a commandline argument to nbconvert.
167 167
168 168 * New nbconvert preprocessor called :class:`~.ClearOutputPreprocessor`. This
169 169 clears the output from IPython notebooks.
170 170
171 171 * New preprocessor for nbconvert that executes all the code cells in a notebook.
172 172 To run a notebook and save its output in a new notebook::
173 173
174 174 ipython nbconvert InputNotebook --ExecutePreprocessor.enabled=True --to notebook --output Executed
175 175
176 176 * Consecutive stream (stdout/stderr) output is merged into a single output
177 177 in the notebook document.
178 178 Previously, all output messages were preserved as separate output fields in the JSON.
179 179 Now, the same merge is applied to the stored output as the displayed output,
180 180 improving document load time for notebooks with many small outputs.
181 181
182 182 * ``NotebookApp.webapp_settings`` is deprecated and replaced with
183 183 the more informatively named ``NotebookApp.tornado_settings``.
184 184
185 185 * Using :magic:`timeit` prints warnings if there is atleast a 4x difference in timings
186 186 between the slowest and fastest runs, since this might meant that the multiple
187 187 runs are not independent of one another.
188 188
189 189 * It's now possible to provide mechanisms to integrate IPython with other event
190 190 loops, in addition to the ones we already support. This lets you run GUI code
191 191 in IPython with an interactive prompt, and to embed the IPython
192 192 kernel in GUI applications. See :doc:`/config/eventloops` for details. As part
193 193 of this, the direct ``enable_*`` and ``disable_*`` functions for various GUIs
194 194 in :mod:`IPython.lib.inputhook` have been deprecated in favour of
195 195 :meth:`~.InputHookManager.enable_gui` and :meth:`~.InputHookManager.disable_gui`.
196 196
197 197 * A ``ScrollManager`` was added to the notebook. The ``ScrollManager`` controls how the notebook document is scrolled using keyboard. Users can inherit from the ``ScrollManager`` or ``TargetScrollManager`` to customize how their notebook scrolls. The default ``ScrollManager`` is the ``SlideScrollManager``, which tries to scroll to the nearest slide or sub-slide cell.
198 198
199 199 * The function :func:`~IPython.html.widgets.interaction.interact_manual` has been
200 200 added which behaves similarly to :func:`~IPython.html.widgets.interaction.interact`,
201 201 but adds a button to explicitly run the interacted-with function, rather than
202 202 doing it automatically for every change of the parameter widgets. This should
203 203 be useful for long-running functions.
204 204
205 205 * The ``%cython`` magic is now part of the Cython module. Use `%load_ext Cython` with a version of Cython >= 0.21 to have access to the magic now.
206 206
207 207 * The Notebook application now offers integrated terminals on Unix platforms,
208 208 intended for when it is used on a remote server. To enable these, install
209 209 the ``terminado`` Python package.
210 210
211 211 * The Notebook application can now edit any plain text files, via a full-page CodeMirror instance.
212 212
213 213 * Setting the default highlighting language for nbconvert with the config option
214 214 ``NbConvertBase.default_language`` is deprecated. Nbconvert now respects
215 215 metadata stored in the :ref:`kernel spec <kernelspecs>`.
216 216
217 217 * IPython can now be configured systemwide, with files in :file:`/etc/ipython`
218 218 or :file:`/usr/local/etc/ipython` on Unix systems,
219 219 or :file:`{%PROGRAMDATA%}\\ipython` on Windows.
220 220
221 221 * Added support for configurable user-supplied `Jinja
222 222 <http://jinja.pocoo.org/>`_ HTML templates for the notebook. Paths to
223 223 directories containing template files can be specified via
224 224 ``NotebookApp.extra_template_paths``. User-supplied template directories
225 225 searched first by the notebook, making it possible to replace existing
226 226 templates with your own files.
227 227
228 228 For example, to replace the notebook's built-in ``error.html`` with your own,
229 229 create a directory like ``/home/my_templates`` and put your override template
230 230 at ``/home/my_templates/error.html``. To start the notebook with your custom
231 231 error page enabled, you would run::
232 232
233 233 ipython notebook '--extra_template_paths=["/home/my_templates/"]'
234 234
235 235 It's also possible to override a template while also `inheriting
236 236 <http://jinja.pocoo.org/docs/dev/templates/#template-inheritance>`_ from that
237 237 template, by prepending ``templates/`` to the ``{% extends %}`` target of
238 238 your child template. This is useful when you only want to override a
239 239 specific block of a template. For example, to add additional CSS to the
240 240 built-in ``error.html``, you might create an override that looks like::
241 241
242 242 {% extends "templates/error.html" %}
243 243
244 244 {% block stylesheet %}
245 245 {{super()}}
246 246 <style type="text/css">
247 247 /* My Awesome CSS */
248 248 </style>
249 249 {% endblock %}
250 250
251 251 * Added a widget persistence API. This allows you to persist your notebooks interactive widgets.
252 252 Two levels of control are provided:
253 253 1. Higher level- ``WidgetManager.set_state_callbacks`` allows you to register callbacks for loading and saving widget state. The callbacks you register are automatically called when necessary.
254 254 2. Lower level- the ``WidgetManager`` Javascript class now has ``get_state`` and ``set_state`` methods that allow you to get and set the state of the widget runtime.
255 255
256 256 Example code for persisting your widget state to session data::
257 257
258 258 %%javascript
259 259 require(['widgets/js/manager'], function(manager) {
260 260 manager.WidgetManager.set_state_callbacks(function() { // Load
261 261 return JSON.parse(sessionStorage.widgets_state || '{}');
262 262 }, function(state) { // Save
263 263 sessionStorage.widgets_state = JSON.stringify(state);
264 264 });
265 265 });
266 266
267 267 * Enhanced support for :magic:`env` magic. As before, :magic:`env` with no
268 268 arguments displays all environment variables and values. Additionally,
269 269 :magic:`env` can be used to get or set individual environment variables. To
270 270 display an individual value, use the `%env var` syntax. To set a value, use
271 271 `env var val` or `env var=val`. Python value expansion using `$` works as usual.
272 272
273 273
274 274 Backwards incompatible changes
275 275 ------------------------------
276 276
277 277 * The :ref:`message protocol <messaging>` has been updated from version 4 to version 5.
278 278 Adapters are included, so IPython frontends can still talk to kernels that
279 279 implement protocol version 4.
280 280
281 * The :ref:`notebook format <nbformat>` has been updated from version 3 to version 4.
281 * The notebook format has been updated from version 3 to version 4.
282 282 Read-only support for v4 notebooks has been backported to IPython 2.4.
283 283 Notable changes:
284 284
285 285 * heading cells are removed in favor or markdown headings
286 286 * notebook outputs and output messages are more consistent with each other
287 287 * use :func:`IPython.nbformat.read` and :func:`~IPython.nbformat.write`
288 288 to read and write notebook files
289 289 instead of the deprecated :mod:`IPython.nbformat.current` APIs.
290 290
291 291 You can downgrade a notebook to v3 via ``nbconvert``::
292 292
293 293 ipython nbconvert --to notebook --nbformat 3 <notebook>
294 294
295 295 which will create :file:`notebook.v3.ipynb`, a copy of the notebook in v3 format.
296 296
297 297 * :func:`IPython.core.oinspect.getsource` call specification has changed:
298 298
299 299 * `oname` keyword argument has been added for property source formatting
300 300 * `is_binary` keyword argument has been dropped, passing ``True`` had
301 301 previously short-circuited the function to return ``None`` unconditionally
302 302
303 303 * Removed the octavemagic extension: it is now available as ``oct2py.ipython``.
304 304
305 305 * Creating PDFs with LaTeX no longer uses a post processor.
306 306 Use `nbconvert --to pdf` instead of `nbconvert --to latex --post pdf`.
307 307
308 308 * Used https://github.com/jdfreder/bootstrap2to3 to migrate the Notebook to Bootstrap 3.
309 309
310 310 Additional changes:
311 311
312 312 - Set `.tab-content .row` `0px;` left and right margin (bootstrap default is `-15px;`)
313 313 - Removed `height: @btn_mini_height;` from `.list_header>div, .list_item>div` in `tree.less`
314 314 - Set `#header` div `margin-bottom: 0px;`
315 315 - Set `#menus` to `float: left;`
316 316 - Set `#maintoolbar .navbar-text` to `float: none;`
317 317 - Added no-padding convenience class.
318 318 - Set border of #maintoolbar to 0px
319 319
320 320 * Accessing the `container` DOM object when displaying javascript has been
321 321 deprecated in IPython 2.0 in favor of accessing `element`. Starting with
322 322 IPython 3.0 trying to access `container` will raise an error in browser
323 323 javascript console.
324 324
325 325 * ``IPython.utils.py3compat.open`` was removed: :func:`io.open` provides all
326 326 the same functionality.
327 327
328 328 * The NotebookManager and ``/api/notebooks`` service has been replaced by
329 329 a more generic ContentsManager and ``/api/contents`` service,
330 330 which supports all kinds of files.
331 331 * The Dashboard now lists all files, not just notebooks and directories.
332 332 * The ``--script`` hook for saving notebooks to Python scripts is removed,
333 333 use :samp:`ipython nbconvert --to python {notebook}` instead.
334 334
335 335 * The ``rmagic`` extension is deprecated, as it is now part of rpy2. See
336 336 :mod:`rpy2.ipython.rmagic`.
337 337
338 338 * :meth:`~.KernelManager.start_kernel` and :meth:`~.KernelManager.format_kernel_cmd`
339 339 no longer accept a ``executable`` parameter. Use the kernelspec machinery instead.
340 340
341 341 * The widget classes have been renamed from `*Widget` to `*`. The old names are
342 342 still functional, but are deprecated. i.e. `IntSliderWidget` has been renamed
343 343 to `IntSlider`.
344 344 * The ContainerWidget was renamed to Box and no longer defaults as a flexible
345 345 box in the web browser. A new FlexBox widget was added, which allows you to
346 346 use the flexible box model.
347 347
348 348 * The notebook now uses a single websocket at `/kernels/<kernel-id>/channels` instead of separate
349 349 `/kernels/<kernel-id>/{shell|iopub|stdin}` channels. Messages on each channel are identified by a
350 350 `channel` key in the message dict, for both send and recv.
351 351
352 352
353 353 Content Security Policy
354 354 ```````````````````````
355 355
356 356 The Content Security Policy is a web standard for adding a layer of security to
357 357 detect and mitigate certain classes of attacks, including Cross Site Scripting
358 358 (XSS) and data injection attacks. This was introduced into the notebook to
359 359 ensure that the IPython Notebook and its APIs (by default) can only be embedded
360 360 in an iframe on the same origin.
361 361
362 362 Override ``headers['Content-Security-Policy']`` within your notebook
363 363 configuration to extend for alternate domains and security settings.::
364 364
365 365 c.NotebookApp.tornado_settings = {
366 366 'headers': {
367 367 'Content-Security-Policy': "frame-ancestors 'self'"
368 368 }
369 369 }
370 370
371 371 Example policies::
372 372
373 373 Content-Security-Policy: default-src 'self' https://*.jupyter.org
374 374
375 375 Matches embeddings on any subdomain of jupyter.org, so long as they are served
376 376 over SSL.
377 377
378 378 There is a `report-uri <https://developer.mozilla.org/en-US/docs/Web/Security/CSP/CSP_policy_directives#report-uri>`_ endpoint available for logging CSP violations, located at
379 379 ``/api/security/csp-report``. To use it, set ``report-uri`` as part of the CSP::
380 380
381 381 c.NotebookApp.tornado_settings = {
382 382 'headers': {
383 383 'Content-Security-Policy': "frame-ancestors 'self'; report-uri /api/security/csp-report"
384 384 }
385 385 }
386 386
387 387 It simply provides the CSP report as a warning in IPython's logs. The default
388 388 CSP sets this report-uri relative to the ``base_url`` (not shown above).
389 389
390 390 For a more thorough and accurate guide on Content Security Policies, check out
391 391 `MDN's Using Content Security Policy <https://developer.mozilla.org/en-US/docs/Web/Security/CSP/Using_Content_Security_Policy>`_ for more examples.
General Comments 0
You need to be logged in to leave comments. Login now