Debian Codegraph @

docs/source/whatsnew/version3.rst

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