##// END OF EJS Templates
add example for downgrading a notebook to v3 in whatsnew
Min RK -
Show More
@@ -1,314 +1,320 b''
1 1 ============
2 2 3.x Series
3 3 ============
4 4
5 5
6 6 Release 3.0
7 7 ===========
8 8
9 9 Coming February, 2015
10 10
11 11 This is a really big release. Over 150 contributors, and almost 6000 commits in a bit under a year.
12 12 Support for languages other than Python is greatly improved,
13 13 notebook UI has been significantly redesigned,
14 14 and a lot of improvement has happened in the experimental interactive widgets.
15 15 The message protocol and document format have both been updated,
16 16 while maintaining better compatibility with previous versions than prior updates.
17 17 The notebook webapp now enables editing of any text file, and even
18 18 a web-based terminal (on Unix platforms).
19 19
20 20 3.x will be the last monolithic release of IPython,
21 21 as the next release cycle will see the growing project split into its Python-specific and language-agnostic components.
22 22 Language-agnostic projects (notebook, qtconsole, etc.) will move under the umbrella of the new Project Jupyter name,
23 23 while Python-specific projects (interactive Python shell, Python kernel, IPython.parallel)
24 24 will remain under IPython, and be split into a few smaller packages.
25 25 To reflect this, IPython is in a bit of a transition state.
26 26 The logo on the notebook is now the Jupyter logo.
27 27 When installing kernels system-wide, they go in a `jupyter` directory.
28 28 We are going to do our best to ease this transition for users and developers.
29 29
30 30 Big changes are ahead.
31 31
32 32
33 33 Using different kernels
34 34 -----------------------
35 35
36 36 .. image:: ../_images/kernel_selector_screenshot.png
37 37 :alt: Screenshot of 'new' dropdown showing different kernels
38 38 :align: center
39 39
40 40 You can now choose a kernel for a notebook within the user interface, rather
41 41 than starting up a separate notebook server for each kernel you want to use. The
42 42 syntax highlighting adapts to match the language you're working in.
43 43
44 44 Information about the kernel is stored in the notebook file, so when you open a
45 45 notebook, it will automatically start the correct kernel.
46 46
47 47 It is also easier to use the Qt console and the terminal console with other
48 48 kernels, using the --kernel flag::
49 49
50 50 ipython qtconsole --kernel bash
51 51 ipython console --kernel bash
52 52
53 53 # To list available kernels
54 54 ipython kernelspec list
55 55
56 56 Kernel authors should see :ref:`kernelspecs` for how to register their kernels
57 57 with IPython so that these mechanisms work.
58 58
59 59 Typing unicode identifiers
60 60 --------------------------
61 61
62 62 .. image:: /_images/unicode_completion.png
63 63
64 64 Complex expressions can be much cleaner when written with a wider choice of
65 65 characters. Python 3 allows unicode identifiers, and IPython 3 makes it easier
66 66 to type those, using a feature from Julia. Type a backslash followed by a LaTeX
67 67 style short name, such as ``\alpha``. Press tab, and it will turn into Ξ±.
68 68
69 69 Widget migration guide
70 70 ----------------------
71 71 The widget framework has a lot of backwards incompatible changes. For information about migrating widget notebooks and custom widgets to 3.0 refer to the :doc:`widget migration guide<version3_widget_migration>`.
72 72
73 73 Other new features
74 74 ------------------
75 75
76 76 * :class:`~.TextWidget` and :class:`~.TextareaWidget` objects now include a
77 77 ``placeholder`` attribute, for displaying placeholder text before the
78 78 user has typed anything.
79 79
80 80 * The :magic:`load` magic can now find the source for objects in the user namespace.
81 81 To enable searching the namespace, use the ``-n`` option.
82 82
83 83 .. sourcecode:: ipython
84 84
85 85 In [1]: %load -n my_module.some_function
86 86
87 87 * :class:`~.DirectView` objects have a new :meth:`~.DirectView.use_cloudpickle`
88 88 method, which works like ``view.use_dill()``, but causes the ``cloudpickle``
89 89 module from PiCloud's `cloud`__ library to be used rather than dill or the
90 90 builtin pickle module.
91 91
92 92 __ https://pypi.python.org/pypi/cloud
93 93
94 94 * Added a .ipynb exporter to nbconvert. It can be used by passing `--to notebook`
95 95 as a commandline argument to nbconvert.
96 96
97 97 * New nbconvert preprocessor called :class:`~.ClearOutputPreprocessor`. This
98 98 clears the output from IPython notebooks.
99 99
100 100 * New preprocessor for nbconvert that executes all the code cells in a notebook.
101 101 To run a notebook and save its output in a new notebook::
102 102
103 103 ipython nbconvert InputNotebook --ExecutePreprocessor.enabled=True --to notebook --output Executed
104 104
105 105 * Consecutive stream (stdout/stderr) output is merged into a single output
106 106 in the notebook document.
107 107 Previously, all output messages were preserved as separate output fields in the JSON.
108 108 Now, the same merge is applied to the stored output as the displayed output,
109 109 improving document load time for notebooks with many small outputs.
110 110
111 111 * ``NotebookApp.webapp_settings`` is deprecated and replaced with
112 112 the more informatively named ``NotebookApp.tornado_settings``.
113 113
114 114 * Using :magic:`timeit` prints warnings if there is atleast a 4x difference in timings
115 115 between the slowest and fastest runs, since this might meant that the multiple
116 116 runs are not independent of one another.
117 117
118 118 * It's now possible to provide mechanisms to integrate IPython with other event
119 119 loops, in addition to the ones we already support. This lets you run GUI code
120 120 in IPython with an interactive prompt, and to embed the IPython
121 121 kernel in GUI applications. See :doc:`/config/eventloops` for details. As part
122 122 of this, the direct ``enable_*`` and ``disable_*`` functions for various GUIs
123 123 in :mod:`IPython.lib.inputhook` have been deprecated in favour of
124 124 :meth:`~.InputHookManager.enable_gui` and :meth:`~.InputHookManager.disable_gui`.
125 125
126 126 * 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.
127 127
128 128 * The function :func:`~IPython.html.widgets.interaction.interact_manual` has been
129 129 added which behaves similarly to :func:`~IPython.html.widgets.interaction.interact`,
130 130 but adds a button to explicitly run the interacted-with function, rather than
131 131 doing it automatically for every change of the parameter widgets. This should
132 132 be useful for long-running functions.
133 133
134 134 * 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.
135 135
136 136 * The Notebook application now offers integrated terminals on Unix platforms,
137 137 intended for when it is used on a remote server. To enable these, install
138 138 the ``terminado`` Python package.
139 139
140 140 * The Notebook application can now edit any plain text files, via a full-page CodeMirror instance.
141 141
142 142 * Setting the default highlighting language for nbconvert with the config option
143 143 ``NbConvertBase.default_language`` is deprecated. Nbconvert now respects
144 144 metadata stored in the :ref:`kernel spec <kernelspecs>`.
145 145
146 146 * IPython can now be configured systemwide, with files in :file:`/etc/ipython`
147 147 or :file:`/usr/local/etc/ipython` on Unix systems,
148 148 or :file:`{%PROGRAMDATA%}\\ipython` on Windows.
149 149
150 150 * Added support for configurable user-supplied `Jinja
151 151 <http://jinja.pocoo.org/>`_ HTML templates for the notebook. Paths to
152 152 directories containing template files can be specified via
153 153 ``NotebookApp.extra_template_paths``. User-supplied template directories
154 154 searched first by the notebook, making it possible to replace existing
155 155 templates with your own files.
156 156
157 157 For example, to replace the notebook's built-in ``error.html`` with your own,
158 158 create a directory like ``/home/my_templates`` and put your override template
159 159 at ``/home/my_templates/error.html``. To start the notebook with your custom
160 160 error page enabled, you would run::
161 161
162 162 ipython notebook '--extra_template_paths=["/home/my_templates/"]'
163 163
164 164 It's also possible to override a template while also `inheriting
165 165 <http://jinja.pocoo.org/docs/dev/templates/#template-inheritance>`_ from that
166 166 template, by prepending ``templates/`` to the ``{% extends %}`` target of
167 167 your child template. This is useful when you only want to override a
168 168 specific block of a template. For example, to add additional CSS to the
169 169 built-in ``error.html``, you might create an override that looks like::
170 170
171 171 {% extends "templates/error.html" %}
172 172
173 173 {% block stylesheet %}
174 174 {{super()}}
175 175 <style type="text/css">
176 176 /* My Awesome CSS */
177 177 </style>
178 178 {% endblock %}
179 179
180 180 * Added a widget persistence API. This allows you to persist your notebooks interactive widgets.
181 181 Two levels of control are provided:
182 182 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.
183 183 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.
184 184
185 185 Example code for persisting your widget state to session data::
186 186
187 187 %%javascript
188 188 require(['widgets/js/manager'], function(manager) {
189 189 manager.WidgetManager.set_state_callbacks(function() { // Load
190 190 return JSON.parse(sessionStorage.widgets_state || '{}');
191 191 }, function(state) { // Save
192 192 sessionStorage.widgets_state = JSON.stringify(state);
193 193 });
194 194 });
195 195
196 196 * Enhanced support for :magic:`env` magic. As before, :magic:`env` with no
197 197 arguments displays all environment variables and values. Additionally,
198 198 :magic:`env` can be used to get or set individual environment variables. To
199 199 display an individual value, use the `%env var` syntax. To set a value, use
200 200 `env var val` or `env var=val`. Python value expansion using `$` works as usual.
201 201
202 202
203 203 Backwards incompatible changes
204 204 ------------------------------
205 205
206 206 * The :ref:`message protocol <messaging>` has been updated from version 4 to version 5.
207 207 Adapters are included, so IPython frontends can still talk to kernels that
208 208 implement protocol version 4.
209 209
210 210 * The :ref:`notebook format <nbformat>` has been updated from version 3 to version 4.
211 211 Read-only support for v4 notebooks has been backported to IPython 2.4.
212 212 Notable changes:
213 213
214 214 * heading cells are removed in favor or markdown headings
215 215 * notebook outputs and output messages are more consistent with each other
216 216 * use :func:`IPython.nbformat.read` and :func:`~IPython.nbformat.write`
217 217 to read and write notebook files
218 218 instead of the deprecated :mod:`IPython.nbformat.current` APIs.
219 219
220 You can downgrade a notebook to v3 via ``nbconvert``::
221
222 ipython nbconvert --to notebook --nbformat 3 [notebook]
223
224 which will create :file:`notebook.v3.ipynb`, a copy of the notebook in v3 format.
225
220 226 * :func:`IPython.core.oinspect.getsource` call specification has changed:
221 227
222 228 * `oname` keyword argument has been added for property source formatting
223 229 * `is_binary` keyword argument has been dropped, passing ``True`` had
224 230 previously short-circuited the function to return ``None`` unconditionally
225 231
226 232 * Removed the octavemagic extension: it is now available as ``oct2py.ipython``.
227 233
228 234 * Creating PDFs with LaTeX no longer uses a post processor.
229 235 Use `nbconvert --to pdf` instead of `nbconvert --to latex --post pdf`.
230 236
231 237 * Used https://github.com/jdfreder/bootstrap2to3 to migrate the Notebook to Bootstrap 3.
232 238
233 239 Additional changes:
234 240
235 241 - Set `.tab-content .row` `0px;` left and right margin (bootstrap default is `-15px;`)
236 242 - Removed `height: @btn_mini_height;` from `.list_header>div, .list_item>div` in `tree.less`
237 243 - Set `#header` div `margin-bottom: 0px;`
238 244 - Set `#menus` to `float: left;`
239 245 - Set `#maintoolbar .navbar-text` to `float: none;`
240 246 - Added no-padding convenience class.
241 247 - Set border of #maintoolbar to 0px
242 248
243 249 * Accessing the `container` DOM object when displaying javascript has been
244 250 deprecated in IPython 2.0 in favor of accessing `element`. Starting with
245 251 IPython 3.0 trying to access `container` will raise an error in browser
246 252 javascript console.
247 253
248 254 * ``IPython.utils.py3compat.open`` was removed: :func:`io.open` provides all
249 255 the same functionality.
250 256
251 257 * The NotebookManager and ``/api/notebooks`` service has been replaced by
252 258 a more generic ContentsManager and ``/api/contents`` service,
253 259 which supports all kinds of files.
254 260 * The Dashboard now lists all files, not just notebooks and directories.
255 261 * The ``--script`` hook for saving notebooks to Python scripts is removed,
256 262 use :samp:`ipython nbconvert --to python {notebook}` instead.
257 263
258 264 * The ``rmagic`` extension is deprecated, as it is now part of rpy2. See
259 265 :mod:`rpy2.ipython.rmagic`.
260 266
261 267 * :meth:`~.KernelManager.start_kernel` and :meth:`~.KernelManager.format_kernel_cmd`
262 268 no longer accept a ``executable`` parameter. Use the kernelspec machinery instead.
263 269
264 270 * The widget classes have been renamed from `*Widget` to `*`. The old names are
265 271 still functional, but are deprecated. i.e. `IntSliderWidget` has been renamed
266 272 to `IntSlider`.
267 273 * The ContainerWidget was renamed to Box and no longer defaults as a flexible
268 274 box in the web browser. A new FlexBox widget was added, which allows you to
269 275 use the flexible box model.
270 276
271 277 * The notebook now uses a single websocket at `/kernels/<kernel-id>/channels` instead of separate
272 278 `/kernels/<kernel-id>/{shell|iopub|stdin}` channels. Messages on each channel are identified by a
273 279 `channel` key in the message dict, for both send and recv.
274 280
275 281
276 282 Content Security Policy
277 283 ```````````````````````
278 284
279 285 The Content Security Policy is a web standard for adding a layer of security to
280 286 detect and mitigate certain classes of attacks, including Cross Site Scripting
281 287 (XSS) and data injection attacks. This was introduced into the notebook to
282 288 ensure that the IPython Notebook and its APIs (by default) can only be embedded
283 289 in an iframe on the same origin.
284 290
285 291 Override ``headers['Content-Security-Policy']`` within your notebook
286 292 configuration to extend for alternate domains and security settings.::
287 293
288 294 c.NotebookApp.tornado_settings = {
289 295 'headers': {
290 296 'Content-Security-Policy': "frame-ancestors 'self'"
291 297 }
292 298 }
293 299
294 300 Example policies::
295 301
296 302 Content-Security-Policy: default-src 'self' https://*.jupyter.org
297 303
298 304 Matches embeddings on any subdomain of jupyter.org, so long as they are served
299 305 over SSL.
300 306
301 307 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
302 308 ``/api/security/csp-report``. To use it, set ``report-uri`` as part of the CSP::
303 309
304 310 c.NotebookApp.tornado_settings = {
305 311 'headers': {
306 312 'Content-Security-Policy': "frame-ancestors 'self'; report-uri /api/security/csp-report"
307 313 }
308 314 }
309 315
310 316 It simply provides the CSP report as a warning in IPython's logs. The default
311 317 CSP sets this report-uri relative to the ``base_url`` (not shown above).
312 318
313 319 For a more thorough and accurate guide on Content Security Policies, check out
314 320 `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