Show More
@@ -1,303 +1,303 b'' | |||
|
1 | 1 | ============ |
|
2 | 2 | 7.x Series |
|
3 | 3 | ============ |
|
4 | 4 | |
|
5 | 5 | .. _whatsnew710: |
|
6 | 6 | |
|
7 | 7 | IPython 7.1.0 |
|
8 | 8 | ============= |
|
9 | 9 | |
|
10 | 10 | |
|
11 | 11 | IPython 7.1.0 is the first minor release after 7.0.0 and mostly bring fixes to |
|
12 | 12 | new feature, internal refactor and regressions that happen during the 6.x->7.x |
|
13 | 13 | transition. It also bring **Compatibility with Python 3.7.1**, as were |
|
14 | 14 | unwillingly relying on a bug in CPython. |
|
15 | 15 | |
|
16 | 16 | New Core Dev: |
|
17 | 17 | |
|
18 | 18 | - We welcome Jonathan Slenders to the commiters. Jonathan has done a fantastic |
|
19 | 19 | work on Prompt toolkit, and we'd like to recognise his impact by giving him |
|
20 | 20 | commit rights. :ghissue:`11397` |
|
21 | 21 | |
|
22 | 22 | Notable New Features: |
|
23 | 23 | |
|
24 | 24 | - Restore functionality and documentation of the **sphinx directive**, which is |
|
25 | 25 | now stricter (fail on error by default), gained configuration options, have a |
|
26 | 26 | brand new documentation page :ref:`ipython_directive`, which need some cleanup. |
|
27 | 27 | It is also now *tested* so we hope to have less regressions. |
|
28 | 28 | :ghpull:`11402` |
|
29 | 29 | |
|
30 | 30 | - ``IPython.display.Video`` now supports ``width`` and ``height`` arguments, |
|
31 | 31 | allowing a custom width and height to be set instead of using the video's |
|
32 | 32 | width and height. :ghpull:`11353` |
|
33 | 33 | |
|
34 | 34 | - Warn when using ``HTML('<iframe>')`` instead of ``IFrame`` :ghpull:`11350` |
|
35 | 35 | |
|
36 | 36 | - Allow Dynamic switching of editing mode between vi/emacs and show |
|
37 | 37 | normal/input mode in prompt when using vi. :ghpull:`11390`. Use ``%config |
|
38 | 38 | TerminalInteractiveShell.editing_mode = 'vi'`` or ``%config |
|
39 | 39 | TerminalInteractiveShell.editing_mode = 'emacs'`` to dynamically spwitch |
|
40 | 40 | |
|
41 | 41 | |
|
42 | 42 | Notable Fixes: |
|
43 | 43 | |
|
44 | 44 | - Fix entering of **multi-line block in terminal** IPython, and various crashes |
|
45 | 45 | in the new input transformation machinery :ghpull:`11354`, :ghpull:`11356`, :ghpull:`11358`, these |
|
46 | 46 | ones also fix a **Compatibility but with Python 3.7.1**. |
|
47 | 47 | |
|
48 | 48 | - Fix moving through generator stack in ipdb :ghpull:`11266` |
|
49 | 49 | |
|
50 | 50 | - Magics arguments now support quoting. :ghpull:`11330` |
|
51 | 51 | |
|
52 | 52 | - Re-add ``rprint`` and ``rprinte`` aliases. :ghpull:`11331` |
|
53 | 53 | |
|
54 | 54 | - Remove implicit dependency to ``ipython_genutils`` :ghpull:`11317` |
|
55 | 55 | |
|
56 | 56 | - Make ``nonlocal`` raise ``SyntaxError`` instead of silently failing in async |
|
57 | 57 | mode. :ghpull:`11382` |
|
58 | 58 | |
|
59 | 59 | |
|
60 | 60 | Notable Internals improvements: |
|
61 | 61 | |
|
62 | 62 | - Use of ``os.scandir`` (Python 3 only) to speedup some file system operations. |
|
63 | 63 | :ghpull:`11365` |
|
64 | 64 | |
|
65 | 65 | - use ``perf_counter`` instead of ``clock`` for more precise |
|
66 | 66 | timing result with ``%time`` :ghpull:`11376` |
|
67 | 67 | |
|
68 | 68 | Many thanks to all the contributors and in particular to ``bartskowron``, and |
|
69 | 69 | ``tonyfast`` who handled a pretty complicated bugs in the input machinery. We |
|
70 | 70 | had a number of first time contributors and maybe hacktoberfest participant that |
|
71 | 71 | made significant contributions, and helped us free some time to focus on more |
|
72 | 72 | complicated bugs. |
|
73 | 73 | |
|
74 | 74 | You |
|
75 | 75 | can see all the closed issues and Merged PR, new features and fixes `here |
|
76 | 76 | <https://github.com/ipython/ipython/issues?utf8=%E2%9C%93&q=+is%3Aclosed+milestone%3A7.1+>`_. |
|
77 | 77 | |
|
78 | 78 | .. _whatsnew700: |
|
79 | 79 | |
|
80 | 80 | IPython 7.0.0 |
|
81 | 81 | ============= |
|
82 | 82 | |
|
83 | 83 | Released Thursday September 27th, 2018 |
|
84 | 84 | |
|
85 | 85 | IPython 7 include major features improvement as you can read in the following |
|
86 | 86 | changelog. This is also the second major version of IPython to support only |
|
87 | 87 | Python 3 βΒ starting at Python 3.4. Python 2 is still community supported |
|
88 | 88 | on the bugfix only 5.x branch, but we remind you that Python 2 "end of life" |
|
89 | 89 | is on Jan 1st 2020. |
|
90 | 90 | |
|
91 | 91 | We were able to backport bug fixes to the 5.x branch thanks to our backport bot which |
|
92 | 92 | backported more than `70 Pull-Requests |
|
93 | 93 | <https://github.com/ipython/ipython/pulls?page=3&q=is%3Apr+sort%3Aupdated-desc+author%3Aapp%2Fmeeseeksdev++5.x&utf8=%E2%9C%93>`_, but there are still many PRs that required manually work, and this is an area of the project were you can easily contribute by looking for `PRs still needed backport <https://github.com/ipython/ipython/issues?q=label%3A%22Still+Needs+Manual+Backport%22+is%3Aclosed+sort%3Aupdated-desc>`_ |
|
94 | 94 | |
|
95 | 95 | IPython 6.x branch will likely not see any further release unless critical |
|
96 | 96 | bugs are found. |
|
97 | 97 | |
|
98 | 98 | Make sure you have pip > 9.0 before upgrading. You should be able to update by simply running |
|
99 | 99 | |
|
100 | 100 | .. code:: |
|
101 | 101 | |
|
102 | 102 | pip install ipython --upgrade |
|
103 | 103 | |
|
104 | 104 | .. only:: ipydev |
|
105 | 105 | |
|
106 | 106 | If you are trying to install or update an ``alpha``, ``beta``, or ``rc`` |
|
107 | 107 | version, use pip ``--pre`` flag. |
|
108 | 108 | |
|
109 | 109 | .. code:: |
|
110 | 110 | |
|
111 | 111 | pip install ipython --upgrade --pre |
|
112 | 112 | |
|
113 | 113 | |
|
114 | 114 | Or if you have conda installed: |
|
115 | 115 | |
|
116 | 116 | .. code:: |
|
117 | 117 | |
|
118 | 118 | conda install ipython |
|
119 | 119 | |
|
120 | 120 | |
|
121 | 121 | |
|
122 | 122 | Prompt Toolkit 2.0 |
|
123 | 123 | ------------------ |
|
124 | 124 | |
|
125 | 125 | IPython 7.0+ now uses ``prompt_toolkit 2.0``, if you still need to use earlier |
|
126 | 126 | ``prompt_toolkit`` version you may need to pin IPython to ``<7.0``. |
|
127 | 127 | |
|
128 | 128 | Autowait: Asynchronous REPL |
|
129 | 129 | --------------------------- |
|
130 | 130 | |
|
131 | 131 | Staring with IPython 7.0 and on Python 3.6+, IPython can automatically await |
|
132 | 132 | code at top level, you should not need to access an event loop or runner |
|
133 | 133 | yourself. To know more read the :ref:`autoawait` section of our docs, see |
|
134 | 134 | :ghpull:`11265` or try the following code:: |
|
135 | 135 | |
|
136 | 136 | Python 3.6.0 |
|
137 | 137 | Type 'copyright', 'credits' or 'license' for more information |
|
138 | 138 | IPython 7.0.0 -- An enhanced Interactive Python. Type '?' for help. |
|
139 | 139 | |
|
140 | 140 | In [1]: import aiohttp |
|
141 | 141 | ...: result = aiohttp.get('https://api.github.com') |
|
142 | 142 | |
|
143 | 143 | In [2]: response = await result |
|
144 | 144 | <pause for a few 100s ms> |
|
145 | 145 | |
|
146 | 146 | In [3]: await response.json() |
|
147 | 147 | Out[3]: |
|
148 | 148 | {'authorizations_url': 'https://api.github.com/authorizations', |
|
149 | 149 | 'code_search_url': 'https://api.github.com/search/code?q={query}{&page,per_page,sort,order}', |
|
150 | 150 | ... |
|
151 | 151 | } |
|
152 | 152 | |
|
153 | 153 | .. note:: |
|
154 | 154 | |
|
155 | 155 | Async integration is experimental code, behavior may change or be removed |
|
156 | 156 | between Python and IPython versions without warnings. |
|
157 | 157 | |
|
158 | 158 | Integration is by default with `asyncio`, but other libraries can be configured, |
|
159 | 159 | like ``curio`` or ``trio``, to improve concurrency in the REPL:: |
|
160 | 160 | |
|
161 | 161 | In [1]: %autoawait trio |
|
162 | 162 | |
|
163 | 163 | In [2]: import trio |
|
164 | 164 | |
|
165 | 165 | In [3]: async def child(i): |
|
166 | 166 | ...: print(" child %s goes to sleep"%i) |
|
167 | 167 | ...: await trio.sleep(2) |
|
168 | 168 | ...: print(" child %s wakes up"%i) |
|
169 | 169 | |
|
170 | 170 | In [4]: print('parent start') |
|
171 | 171 | ...: async with trio.open_nursery() as n: |
|
172 | 172 | ...: for i in range(3): |
|
173 | 173 | ...: n.spawn(child, i) |
|
174 | 174 | ...: print('parent end') |
|
175 | 175 | parent start |
|
176 | 176 | child 2 goes to sleep |
|
177 | 177 | child 0 goes to sleep |
|
178 | 178 | child 1 goes to sleep |
|
179 | 179 | <about 2 seconds pause> |
|
180 | 180 | child 2 wakes up |
|
181 | 181 | child 1 wakes up |
|
182 | 182 | child 0 wakes up |
|
183 | 183 | parent end |
|
184 | 184 | |
|
185 | 185 | See :ref:`autoawait` for more information. |
|
186 | 186 | |
|
187 | 187 | |
|
188 | 188 | Asynchronous code in a Notebook interface or any other frontend using the |
|
189 | 189 | Jupyter Protocol will need further updates of the IPykernel package. |
|
190 | 190 | |
|
191 | 191 | Non-Asynchronous code |
|
192 | 192 | ~~~~~~~~~~~~~~~~~~~~~ |
|
193 | 193 | |
|
194 | 194 | As the internal API of IPython is now asynchronous, IPython needs to run under |
|
195 | 195 | an event loop. In order to allow many workflows, (like using the :magic:`%run` |
|
196 | 196 | magic, or copy_pasting code that explicitly starts/stop event loop), when |
|
197 | 197 | top-level code is detected as not being asynchronous, IPython code is advanced |
|
198 | 198 | via a pseudo-synchronous runner, and may not advance pending tasks. |
|
199 | 199 | |
|
200 | 200 | Change to Nested Embed |
|
201 | 201 | ~~~~~~~~~~~~~~~~~~~~~~ |
|
202 | 202 | |
|
203 | 203 | The introduction of the ability to run async code had some effect on the |
|
204 | 204 | ``IPython.embed()`` API. By default embed will not allow you to run asynchronous |
|
205 | 205 | code unless a event loop is specified. |
|
206 | 206 | |
|
207 | 207 | Effects on Magics |
|
208 | 208 | ~~~~~~~~~~~~~~~~~ |
|
209 | 209 | |
|
210 | 210 | Some magics will not work with Async, and will need updates. Contribution |
|
211 | 211 | welcome. |
|
212 | 212 | |
|
213 | 213 | Expected Future changes |
|
214 | 214 | ~~~~~~~~~~~~~~~~~~~~~~~ |
|
215 | 215 | |
|
216 | 216 | We expect more internal but public IPython function to become ``async``, and |
|
217 | 217 | will likely end up having a persisting event loop while IPython is running. |
|
218 | 218 | |
|
219 | 219 | Thanks |
|
220 | 220 | ~~~~~~ |
|
221 | 221 | |
|
222 | 222 | This took more than a year in the making, and the code was rebased a number of |
|
223 | 223 | time leading to commit authorship that may have been lost in the final |
|
224 | 224 | Pull-Request. Huge thanks to many people for contribution, discussion, code, |
|
225 | 225 | documentation, use-case: dalejung, danielballan, ellisonbg, fperez, gnestor, |
|
226 | 226 | minrk, njsmith, pganssle, tacaswell, takluyver , vidartf ... And many others. |
|
227 | 227 | |
|
228 | 228 | |
|
229 | 229 | Autoreload Improvement |
|
230 | 230 | ---------------------- |
|
231 | 231 | |
|
232 | 232 | The magic :magic:`%autoreload 2 <autoreload>` now captures new methods added to |
|
233 | 233 | classes. Earlier, only methods existing as of the initial import were being |
|
234 | 234 | tracked and updated. |
|
235 | 235 | |
|
236 | 236 | This new feature helps dual environment development - Jupyter+IDE - where the |
|
237 | 237 | code gradually moves from notebook cells to package files, as it gets |
|
238 | 238 | structured. |
|
239 | 239 | |
|
240 | 240 | **Example**: An instance of the class ``MyClass`` will be able to access the |
|
241 | 241 | method ``cube()`` after it is uncommented and the file ``file1.py`` saved on |
|
242 | 242 | disk. |
|
243 | 243 | |
|
244 | 244 | |
|
245 | ..code:: | |
|
245 | .. code:: | |
|
246 | 246 | |
|
247 | 247 | # notebook |
|
248 | 248 | |
|
249 | 249 | from mymodule import MyClass |
|
250 | 250 | first = MyClass(5) |
|
251 | 251 | |
|
252 | 252 | .. code:: |
|
253 | 253 | |
|
254 | 254 | # mymodule/file1.py |
|
255 | 255 | |
|
256 | 256 | class MyClass: |
|
257 | 257 | |
|
258 | 258 | def __init__(self, a=10): |
|
259 | 259 | self.a = a |
|
260 | 260 | |
|
261 | 261 | def square(self): |
|
262 | 262 | print('compute square') |
|
263 | 263 | return self.a*self.a |
|
264 | 264 | |
|
265 | 265 | # def cube(self): |
|
266 | 266 | # print('compute cube') |
|
267 | 267 | # return self.a*self.a*self.a |
|
268 | 268 | |
|
269 | 269 | |
|
270 | 270 | |
|
271 | 271 | |
|
272 | 272 | Misc |
|
273 | 273 | ---- |
|
274 | 274 | |
|
275 | 275 | The autoindent feature that was deprecated in 5.x was re-enabled and |
|
276 | 276 | un-deprecated in :ghpull:`11257` |
|
277 | 277 | |
|
278 | 278 | Make :magic:`%run -n -i ... <run>` work correctly. Earlier, if :magic:`%run` was |
|
279 | 279 | passed both arguments, ``-n`` would be silently ignored. See :ghpull:`10308` |
|
280 | 280 | |
|
281 | 281 | |
|
282 | 282 | The :cellmagic:`%%script` (as well as :cellmagic:`%%bash`, |
|
283 | 283 | :cellmagic:`%%ruby`... ) cell magics now raise by default if the return code of |
|
284 | 284 | the given code is non-zero (thus halting execution of further cells in a |
|
285 | 285 | notebook). The behavior can be disable by passing the ``--no-raise-error`` flag. |
|
286 | 286 | |
|
287 | 287 | |
|
288 | 288 | Deprecations |
|
289 | 289 | ------------ |
|
290 | 290 | |
|
291 | 291 | A couple of unused function and methods have been deprecated and will be removed |
|
292 | 292 | in future versions: |
|
293 | 293 | |
|
294 | 294 | - ``IPython.utils.io.raw_print_err`` |
|
295 | 295 | - ``IPython.utils.io.raw_print`` |
|
296 | 296 | |
|
297 | 297 | |
|
298 | 298 | Backwards incompatible changes |
|
299 | 299 | ------------------------------ |
|
300 | 300 | |
|
301 | 301 | * The API for transforming input before it is parsed as Python code has been |
|
302 | 302 | completely redesigned, and any custom input transformations will need to be |
|
303 | 303 | rewritten. See :doc:`/config/inputtransforms` for details of the new API. |
General Comments 0
You need to be logged in to leave comments.
Login now