Show More
@@ -1,298 +1,294 b'' | |||
|
1 | 1 | ============ |
|
2 | 2 | 1.0 Series |
|
3 | 3 | ============ |
|
4 | 4 | |
|
5 | 5 | Release 1.0 |
|
6 | 6 | =========== |
|
7 | 7 | |
|
8 | .. note:: | |
|
9 | ||
|
10 | This document describes a pre-release version of IPython. | |
|
11 | ||
|
12 | 8 | IPython 1.0 requires Python β₯ 2.6.5 or β₯ 3.2.1. |
|
13 | 9 | It does not support Python 3.0, 3.1, or 2.5. |
|
14 | 10 | |
|
15 | 11 | This is a big release. The principal milestone is the addition of :mod:`IPython.nbconvert`, |
|
16 | 12 | but there has been a great deal of work improving all parts of IPython as well. |
|
17 | 13 | |
|
18 | 14 | The previous version (0.13) was released on June 30, 2012, |
|
19 | 15 | and in this development cycle we had: |
|
20 | 16 | |
|
21 | 17 | - ~12 months of work. |
|
22 | 18 | - ~700 pull requests merged. |
|
23 | 19 | - ~600 issues closed (non-pull requests). |
|
24 | 20 | - contributions from ~150 authors. |
|
25 | 21 | - ~4000 commits. |
|
26 | 22 | |
|
27 | 23 | The amount of work included in this release is so large that we can only cover |
|
28 | 24 | here the main highlights; please see our :ref:`detailed release statistics |
|
29 | 25 | <issues_list_100>` for links to every issue and pull request closed on GitHub |
|
30 | 26 | as well as a full list of individual contributors. |
|
31 | 27 | It includes |
|
32 | 28 | |
|
33 | 29 | Reorganization |
|
34 | 30 | -------------- |
|
35 | 31 | |
|
36 | 32 | There have been two major reorganizations in IPython 1.0: |
|
37 | 33 | |
|
38 | 34 | - Added :mod:`IPython.kernel` for all kernel-related code. |
|
39 | 35 | This means that :mod:`IPython.zmq` has been removed, |
|
40 | 36 | and much of it is now in :mod:`IPython.kernel.zmq`, |
|
41 | 37 | some of it being in the top-level :mod:`IPython.kernel`. |
|
42 | 38 | - We have removed the `frontend` subpackage, |
|
43 | 39 | as it caused unnecessary depth. So what was :mod:`IPython.frontend.qt` |
|
44 | 40 | is now :mod:`IPython.qt`, and so on. The one difference is that |
|
45 | 41 | the notebook has been further flattened, so that |
|
46 | 42 | :mod:`IPython.frontend.html.notebook` is now just `IPython.html`. |
|
47 | 43 | There is a shim module, so :mod:`IPython.frontend` is still |
|
48 | 44 | importable in 1.0, but there will be a warning. |
|
49 | 45 | - The IPython sphinx directives are now installed in :mod:`IPython.sphinx`, |
|
50 | 46 | so they can be imported by other projects. |
|
51 | 47 | |
|
52 | 48 | |
|
53 | 49 | Public APIs |
|
54 | 50 | ----------- |
|
55 | 51 | |
|
56 | 52 | For the first time since 0.10 (sorry, everyone), |
|
57 | 53 | there is an official public API for starting IPython: |
|
58 | 54 | |
|
59 | 55 | .. sourcecode:: python |
|
60 | 56 | |
|
61 | 57 | from IPython import start_ipython |
|
62 | 58 | start_ipython() |
|
63 | 59 | |
|
64 | 60 | This is what packages should use that start their own IPython session, |
|
65 | 61 | but don't actually want embedded IPython (most cases). |
|
66 | 62 | :func:`IPython.embed()` is used for embedding IPython into the calling namespace, |
|
67 | 63 | similar to calling :func:`Pdb.set_trace`, whereas :func:`start_ipython` |
|
68 | 64 | will start a plain IPython session, loading config and startup files as normal. |
|
69 | 65 | |
|
70 | 66 | We also have added: |
|
71 | 67 | |
|
72 | 68 | .. sourcecode:: python |
|
73 | 69 | |
|
74 | 70 | from IPython import get_ipython |
|
75 | 71 | |
|
76 | 72 | |
|
77 | 73 | Which is a *library* function for getting the current IPython instance, |
|
78 | 74 | and will return ``None`` if no IPython instance is running. |
|
79 | 75 | This is the official way to check whether your code is called from inside an IPython session. |
|
80 | 76 | If you want to check for IPython without unnecessarily importing IPython, |
|
81 | 77 | use this function: |
|
82 | 78 | |
|
83 | 79 | .. sourcecode:: python |
|
84 | 80 | |
|
85 | 81 | def get_ipython(): |
|
86 | 82 | """return IPython instance if there is one, None otherwise""" |
|
87 | 83 | import sys |
|
88 | 84 | if "IPython" in sys.modules: |
|
89 | 85 | import IPython |
|
90 | 86 | return IPython.get_ipython() |
|
91 | 87 | |
|
92 | 88 | Core |
|
93 | 89 | ---- |
|
94 | 90 | |
|
95 | 91 | - The input transformation framework has been reworked. This fixes some corner |
|
96 | 92 | cases, and adds more flexibility for projects which use IPython, like SymPy & |
|
97 | 93 | SAGE. For more details, see :doc:`/config/inputtransforms`. |
|
98 | 94 | - Exception types can now be displayed with a custom traceback, by defining a |
|
99 | 95 | ``_render_traceback_()`` method which returns a list of strings, each |
|
100 | 96 | containing one line of the traceback. |
|
101 | 97 | - A new command, ``ipython history trim`` can be used to delete everything but |
|
102 | 98 | the last 1000 entries in the history database. |
|
103 | 99 | - ``__file__`` is defined in both config files at load time, |
|
104 | 100 | and ``.ipy`` files executed with ``%run``. |
|
105 | 101 | - ``%logstart`` and ``%logappend`` are no longer broken. |
|
106 | 102 | - Add glob expansion for ``%run``, e.g. ``%run -g script.py *.txt``. |
|
107 | 103 | - Expand variables (``$foo``) in Cell Magic argument line. |
|
108 | 104 | - By default, :command:`iptest` will exclude various slow tests. |
|
109 | 105 | All tests can be run with :command:`iptest --all`. |
|
110 | 106 | - SQLite history can be disabled in the various cases that it does not behave well. |
|
111 | 107 | - ``%edit`` works on interactively defined variables. |
|
112 | 108 | - editor hooks have been restored from quarantine, enabling TextMate as editor, |
|
113 | 109 | etc. |
|
114 | 110 | - The env variable PYTHONSTARTUP is respected by IPython. |
|
115 | 111 | - A ``%matplotlib`` magic is added, which is like the old ``%pylab`` magic, |
|
116 | 112 | but it does not import anything to the interactive namespace. |
|
117 | 113 | It is recommended that users switch to ``%matplotlib`` and explicit imports. |
|
118 | 114 | |
|
119 | 115 | |
|
120 | 116 | Backwards incompatible changes |
|
121 | 117 | ****************************** |
|
122 | 118 | |
|
123 | 119 | - Calling :meth:`InteractiveShell.prefilter` will no longer perform static |
|
124 | 120 | transformations - the processing of escaped commands such as ``%magic`` and |
|
125 | 121 | ``!system``, and stripping input prompts from code blocks. This functionality |
|
126 | 122 | was duplicated in :mod:`IPython.core.inputsplitter`, and the latter version |
|
127 | 123 | was already what IPython relied on. A new API to transform input will be ready |
|
128 | 124 | before release. |
|
129 | 125 | - Functions from :mod:`IPython.lib.inputhook` to control integration with GUI |
|
130 | 126 | event loops are no longer exposed in the top level of :mod:`IPython.lib`. |
|
131 | 127 | Code calling these should make sure to import them from |
|
132 | 128 | :mod:`IPython.lib.inputhook`. |
|
133 | 129 | - For all kernel managers, the ``sub_channel`` attribute has been renamed to |
|
134 | 130 | ``iopub_channel``. |
|
135 | 131 | - Users on Python versions before 2.6.6, 2.7.1 or 3.2 will now need to call |
|
136 | 132 | :func:`IPython.utils.doctestreload.doctest_reload` to make doctests run |
|
137 | 133 | correctly inside IPython. Python releases since those versions are unaffected. |
|
138 | 134 | For details, see :ghpull:`3068` and `Python issue 8048 <http://bugs.python.org/issue8048>`_. |
|
139 | 135 | - The ``InteractiveShell.cache_main_mod()`` method has been removed, and |
|
140 | 136 | :meth:`~IPython.core.interactiveshell.InteractiveShell.new_main_mod` has a |
|
141 | 137 | different signature, expecting a filename where earlier versions expected |
|
142 | 138 | a namespace. See :ghpull:`3555` for details. |
|
143 | 139 | - The short-lived plugin system has been removed. Extensions are the way to go. |
|
144 | 140 | |
|
145 | 141 | |
|
146 | 142 | .. _nbconvert1: |
|
147 | 143 | |
|
148 | 144 | NbConvert |
|
149 | 145 | --------- |
|
150 | 146 | |
|
151 | 147 | The major milestone for IPython 1.0 is the addition of :mod:`IPython.nbconvert` - tools for converting |
|
152 | 148 | IPython notebooks to various other formats. |
|
153 | 149 | |
|
154 | 150 | .. warning:: |
|
155 | 151 | |
|
156 | 152 | nbconvert is Ξ±-level preview code in 1.0 |
|
157 | 153 | |
|
158 | 154 | To use nbconvert to convert various file formats:: |
|
159 | 155 | |
|
160 | 156 | ipython nbconvert --format full_html *.ipynb |
|
161 | 157 | |
|
162 | 158 | See ``ipython nbconvert --help`` for more information. |
|
163 | 159 | nbconvert depends on `pandoc`_ for many of the translations to and from various formats. |
|
164 | 160 | |
|
165 | 161 | .. _pandoc: http://johnmacfarlane.net/pandoc/ |
|
166 | 162 | |
|
167 | 163 | Notebook |
|
168 | 164 | -------- |
|
169 | 165 | |
|
170 | 166 | Major changes to the IPython Notebook in 1.0: |
|
171 | 167 | |
|
172 | 168 | - The notebook is now autosaved, by default at an interval of two minutes. |
|
173 | 169 | When you press 'save' or Ctrl-S, a *checkpoint* is made, in a hidden folder. |
|
174 | 170 | This checkpoint can be restored, so that the autosave model is strictly safer |
|
175 | 171 | than traditional save. If you change nothing about your save habits, |
|
176 | 172 | you will always have a checkpoint that you have written, |
|
177 | 173 | and an autosaved file that is kept up to date. |
|
178 | 174 | - You can load custom javascript and CSS in the notebook by editing the files |
|
179 | 175 | :file:`$(ipython locate profile)/static/custom/custom.{js,css}`. |
|
180 | 176 | - Add ``%%html``, ``%%svg``, ``%%javascript``, and ``%%latex`` cell magics |
|
181 | 177 | for writing raw output in notebook cells. |
|
182 | 178 | - add a redirect handler and anchors on heading cells, so you can link |
|
183 | 179 | across notebooks, directly to heading cells in other notebooks. |
|
184 | 180 | - Images support width and height metadata, |
|
185 | 181 | and thereby 2x scaling (retina support). |
|
186 | 182 | - ``_repr_foo_`` methods can return a tuple of (data, metadata), |
|
187 | 183 | where metadata is a dict containing metadata about the displayed object. |
|
188 | 184 | This is used to set size, etc. for retina graphics. To enable retina matplotlib figures, |
|
189 | 185 | simply set ``InlineBackend.figure_format = 'retina'`` for 2x PNG figures. |
|
190 | 186 | - Add display.FileLink and FileLinks for quickly displaying HTML links to local files. |
|
191 | 187 | - Cells have metadata, which can be edited via cell toolbars. |
|
192 | 188 | This metadata can be used by external code (e.g. reveal.js or exporters), |
|
193 | 189 | when examining the notebook. |
|
194 | 190 | - Fix an issue parsing LaTeX in markdown cells, which required users to type ``\\\``, |
|
195 | 191 | instead of ``\\``. |
|
196 | 192 | - Notebook templates are rendered with Jinja instead of Tornado. |
|
197 | 193 | - ``%%file`` has been renamed ``%%writefile`` (``%%file``) is deprecated. |
|
198 | 194 | - ANSI (and VT100) color parsing has been improved in both performance and |
|
199 | 195 | supported values. |
|
200 | 196 | - The static files path can be found as ``IPython.html.DEFAULT_STATIC_FILES_PATH``, |
|
201 | 197 | which may be changed by package managers. |
|
202 | 198 | - The notebook supports :func:`raw_input`, and thus also ``%debug``. |
|
203 | 199 | - IPython's CSS is installed in :file:`static/css/style.min.css` |
|
204 | 200 | (all style, including bootstrap), and :file:`static/css/ipython.min.css`, |
|
205 | 201 | which only has IPython's own CSS. The latter file should be useful for embedding |
|
206 | 202 | IPython notebooks in other pages, blogs, etc. |
|
207 | 203 | - The Print View has been removed. Users are encouraged to test :ref:`ipython |
|
208 | 204 | nbconvert <nbconvert1>` to generate a static view. |
|
209 | 205 | |
|
210 | 206 | Javascript Components |
|
211 | 207 | ********************* |
|
212 | 208 | |
|
213 | 209 | The javascript components used in the notebook have been updated significantly. |
|
214 | 210 | |
|
215 | 211 | - updates to jQuery (2.0) and jQueryUI (1.10) |
|
216 | 212 | - Update CodeMirror to 3.14 |
|
217 | 213 | - Twitter Bootstrap (2.3) for layout |
|
218 | 214 | - Font-Awesome (3.1) for icons |
|
219 | 215 | - highlight.js (7.3) for syntax highlighting |
|
220 | 216 | - marked (0.2.8) for markdown rendering |
|
221 | 217 | - require.js (2.1) for loading javascript |
|
222 | 218 | |
|
223 | 219 | Some relevant changes that are results of this: |
|
224 | 220 | |
|
225 | 221 | - Markdown cells now support GitHub-flavored Markdown (GFM), |
|
226 | 222 | which includes ``\`\`\`python`` code blocks and tables. |
|
227 | 223 | - Notebook UI behaves better on more screen sizes. |
|
228 | 224 | - Various code cell input issues have been fixed. |
|
229 | 225 | |
|
230 | 226 | |
|
231 | 227 | Kernel |
|
232 | 228 | ------ |
|
233 | 229 | |
|
234 | 230 | The kernel code has been substantially reorganized. |
|
235 | 231 | |
|
236 | 232 | New features in the kernel: |
|
237 | 233 | |
|
238 | 234 | - Kernels support ZeroMQ IPC transport, not just TCP |
|
239 | 235 | - The message protocol has added a top-level metadata field, |
|
240 | 236 | used for information about messages. |
|
241 | 237 | - Add a `data_pub` message that functions much like `display_pub`, |
|
242 | 238 | but publishes raw (usually pickled) data, rather than representations. |
|
243 | 239 | - Ensure that ``sys.stdout.encoding`` is defined in Kernels. |
|
244 | 240 | - Stdout from forked subprocesses should be forwarded to frontends (instead of crashing). |
|
245 | 241 | |
|
246 | 242 | IPEP 13 |
|
247 | 243 | ******* |
|
248 | 244 | |
|
249 | 245 | The KernelManager has been split into a :class:`~.KernelManager` and a :class:`~.KernelClient`. |
|
250 | 246 | The Manager owns a kernel and starts / signals / restarts it. There is always zero or one |
|
251 | 247 | KernelManager per Kernel. Clients communicate with Kernels via zmq channels, |
|
252 | 248 | and there can be zero-to-many Clients connected to a Kernel at any given time. |
|
253 | 249 | |
|
254 | 250 | The KernelManager now automatically restarts the kernel when it dies, |
|
255 | 251 | rather than requiring user input at the notebook or QtConsole UI |
|
256 | 252 | (which may or may not exist at restart time). |
|
257 | 253 | |
|
258 | 254 | In-process kernels |
|
259 | 255 | ****************** |
|
260 | 256 | |
|
261 | 257 | The Python-language frontends, particularly the Qt console, may now communicate |
|
262 | 258 | with in-process kernels, in addition to the traditional out-of-process |
|
263 | 259 | kernels. An in-process kernel permits direct access to the kernel namespace, |
|
264 | 260 | which is necessary in some applications. It should be understood, however, that |
|
265 | 261 | the in-process kernel is not robust to bad user input and will block the main |
|
266 | 262 | (GUI) thread while executing. Developers must decide on a case-by-case basis |
|
267 | 263 | whether this tradeoff is appropriate for their application. |
|
268 | 264 | |
|
269 | 265 | |
|
270 | 266 | |
|
271 | 267 | Parallel |
|
272 | 268 | -------- |
|
273 | 269 | |
|
274 | 270 | IPython.parallel has had some refactoring as well. |
|
275 | 271 | There are many improvements and fixes, but these are the major changes: |
|
276 | 272 | |
|
277 | 273 | - Connections have been simplified. All ports and the serialization in use |
|
278 | 274 | are written to the connection file, rather than the initial two-stage system. |
|
279 | 275 | - Serialization has been rewritten, fixing many bugs and dramatically improving |
|
280 | 276 | performance serializing large containers. |
|
281 | 277 | - Load-balancing scheduler performance with large numbers of tasks has been dramatically improved. |
|
282 | 278 | - There should be fewer (hopefully zero) false-positives for engine failures. |
|
283 | 279 | - Increased compatibility with various use cases that produced serialization / argument errors |
|
284 | 280 | with map, etc. |
|
285 | 281 | - The controller can attempt to resume operation if it has crashed, |
|
286 | 282 | by passing ``ipcontroller --restore``. |
|
287 | 283 | - Engines can monitor the Hub heartbeat, and shutdown if the Hub disappears for too long. |
|
288 | 284 | - add HTCondor support in launchers |
|
289 | 285 | |
|
290 | 286 | |
|
291 | 287 | QtConsole |
|
292 | 288 | --------- |
|
293 | 289 | |
|
294 | 290 | Various fixes, including improved performance with lots of text output, |
|
295 | 291 | and better drag and drop support. |
|
296 | 292 | The initial window size of the qtconsole is now configurable via ``IPythonWidget.width`` |
|
297 | 293 | and ``IPythonWidget.height``. |
|
298 | 294 |
General Comments 0
You need to be logged in to leave comments.
Login now