##// END OF EJS Templates
Fix a paragraph that read very poorly
wim glenn -
Show More
@@ -1,230 +1,230 b''
1 1 ============
2 2 7.x Series
3 3 ============
4 4
5 5 .. _whatsnew700:
6 6
7 7 IPython 7.0.0
8 8 =============
9 9
10 10 Released Thursday September 27th, 2018
11 11
12 12 IPython 7 include major features improvement as you can read in the following
13 13 changelog. This is also the second major version of IPython to support only
14 14 Python 3 – starting at Python 3.4. Python 2 is still community supported
15 15 on the bugfix only 5.x branch, but we remind you that Python 2 "end of life"
16 16 is on Jan 1st 2020.
17 17
18 18 We were able to backport bug fixes to the 5.x branch thanks to our backport bot which
19 19 backported more than `70 Pull-Requests
20 20 <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>`_
21 21
22 22 IPython 6.x branch will likely not see any further release unless critical
23 23 bugs are found.
24 24
25 25 Make sure you have pip > 9.0 before upgrading. You should be able to update by simply running
26 26
27 27 .. code::
28 28
29 29 pip install ipython --upgrade
30 30
31 31 .. only:: ipydev
32 32
33 33 If you are trying to install or update an ``alpha``, ``beta``, or ``rc``
34 34 version, use pip ``--pre`` flag.
35 35
36 36 .. code::
37 37
38 38 pip install ipython --upgrade --pre
39 39
40 40
41 41 Or if you have conda installed:
42 42
43 43 .. code::
44 44
45 45 conda install ipython
46 46
47 47
48 48
49 49 Prompt Toolkit 2.0
50 50 ------------------
51 51
52 52 IPython 7.0+ now uses ``prompt_toolkit 2.0``, if you still need to use earlier
53 53 ``prompt_toolkit`` version you may need to pin IPython to ``<7.0``.
54 54
55 55 Autowait: Asynchronous REPL
56 56 ---------------------------
57 57
58 58 Staring with IPython 7.0 and on Python 3.6+, IPython can automatically await
59 59 code at top level, you should not need to access an event loop or runner
60 60 yourself. To know more read the :ref:`autoawait` section of our docs, see
61 61 :ghpull:`11265` or try the following code::
62 62
63 63 Python 3.6.0
64 64 Type 'copyright', 'credits' or 'license' for more information
65 65 IPython 7.0.0 -- An enhanced Interactive Python. Type '?' for help.
66 66
67 67 In [1]: import aiohttp
68 68 ...: result = aiohttp.get('https://api.github.com')
69 69
70 70 In [2]: response = await result
71 71 <pause for a few 100s ms>
72 72
73 73 In [3]: await response.json()
74 74 Out[3]:
75 75 {'authorizations_url': 'https://api.github.com/authorizations',
76 76 'code_search_url': 'https://api.github.com/search/code?q={query}{&page,per_page,sort,order}',
77 77 ...
78 78 }
79 79
80 80 .. note::
81 81
82 82 Async integration is experimental code, behavior may change or be removed
83 83 between Python and IPython versions without warnings.
84 84
85 85 Integration is by default with `asyncio`, but other libraries can be configured,
86 86 like ``curio`` or ``trio``, to improve concurrency in the REPL::
87 87
88 88 In [1]: %autoawait trio
89 89
90 90 In [2]: import trio
91 91
92 92 In [3]: async def child(i):
93 93 ...: print(" child %s goes to sleep"%i)
94 94 ...: await trio.sleep(2)
95 95 ...: print(" child %s wakes up"%i)
96 96
97 97 In [4]: print('parent start')
98 98 ...: async with trio.open_nursery() as n:
99 99 ...: for i in range(3):
100 100 ...: n.spawn(child, i)
101 101 ...: print('parent end')
102 102 parent start
103 103 child 2 goes to sleep
104 104 child 0 goes to sleep
105 105 child 1 goes to sleep
106 106 <about 2 seconds pause>
107 107 child 2 wakes up
108 108 child 1 wakes up
109 109 child 0 wakes up
110 110 parent end
111 111
112 112 See :ref:`autoawait` for more information.
113 113
114 114
115 115 Asynchronous code in a Notebook interface or any other frontend using the
116 116 Jupyter Protocol will need further updates of the IPykernel package.
117 117
118 118 Non-Asynchronous code
119 119 ~~~~~~~~~~~~~~~~~~~~~
120 120
121 As the internal API of IPython are now asynchronous, IPython need to run under
122 an even loop. In order to allow many workflow, (like using the :magic:`%run`
121 As the internal API of IPython is now asynchronous, IPython needs to run under
122 an event loop. In order to allow many workflows, (like using the :magic:`%run`
123 123 magic, or copy_pasting code that explicitly starts/stop event loop), when
124 124 top-level code is detected as not being asynchronous, IPython code is advanced
125 via a pseudo-synchronous runner, and will not may not advance pending tasks.
125 via a pseudo-synchronous runner, and may not advance pending tasks.
126 126
127 127 Change to Nested Embed
128 128 ~~~~~~~~~~~~~~~~~~~~~~
129 129
130 130 The introduction of the ability to run async code had some effect on the
131 131 ``IPython.embed()`` API. By default embed will not allow you to run asynchronous
132 132 code unless a event loop is specified.
133 133
134 134 Effects on Magics
135 135 ~~~~~~~~~~~~~~~~~
136 136
137 137 Some magics will not work with Async, and will need updates. Contribution
138 138 welcome.
139 139
140 140 Expected Future changes
141 141 ~~~~~~~~~~~~~~~~~~~~~~~
142 142
143 143 We expect more internal but public IPython function to become ``async``, and
144 144 will likely end up having a persisting event loop while IPython is running.
145 145
146 146 Thanks
147 147 ~~~~~~
148 148
149 149 This took more than a year in the making, and the code was rebased a number of
150 150 time leading to commit authorship that may have been lost in the final
151 151 Pull-Request. Huge thanks to many people for contribution, discussion, code,
152 152 documentation, use-case: dalejung, danielballan, ellisonbg, fperez, gnestor,
153 153 minrk, njsmith, pganssle, tacaswell, takluyver , vidartf ... And many others.
154 154
155 155
156 156 Autoreload Improvement
157 157 ----------------------
158 158
159 159 The magic :magic:`%autoreload 2 <autoreload>` now captures new methods added to
160 160 classes. Earlier, only methods existing as of the initial import were being
161 161 tracked and updated.
162 162
163 163 This new feature helps dual environment development - Jupyter+IDE - where the
164 164 code gradually moves from notebook cells to package files, as it gets
165 165 structured.
166 166
167 167 **Example**: An instance of the class ``MyClass`` will be able to access the
168 168 method ``cube()`` after it is uncommented and the file ``file1.py`` saved on
169 169 disk.
170 170
171 171
172 172 ..code::
173 173
174 174 # notebook
175 175
176 176 from mymodule import MyClass
177 177 first = MyClass(5)
178 178
179 179 .. code::
180 180
181 181 # mymodule/file1.py
182 182
183 183 class MyClass:
184 184
185 185 def __init__(self, a=10):
186 186 self.a = a
187 187
188 188 def square(self):
189 189 print('compute square')
190 190 return self.a*self.a
191 191
192 192 # def cube(self):
193 193 # print('compute cube')
194 194 # return self.a*self.a*self.a
195 195
196 196
197 197
198 198
199 199 Misc
200 200 ----
201 201
202 202 The autoindent feature that was deprecated in 5.x was re-enabled and
203 203 un-deprecated in :ghpull:`11257`
204 204
205 205 Make :magic:`%run -n -i ... <run>` work correctly. Earlier, if :magic:`%run` was
206 206 passed both arguments, ``-n`` would be silently ignored. See :ghpull:`10308`
207 207
208 208
209 209 The :cellmagic:`%%script`` (as well as :cellmagic:`%%bash``,
210 210 :cellmagic:`%%ruby``... ) cell magics now raise by default if the return code of
211 211 the given code is non-zero (thus halting execution of further cells in a
212 212 notebook). The behavior can be disable by passing the ``--no-raise-error`` flag.
213 213
214 214
215 215 Deprecations
216 216 ------------
217 217
218 218 A couple of unused function and methods have been deprecated and will be removed
219 219 in future versions:
220 220
221 221 - ``IPython.utils.io.raw_print_err``
222 222 - ``IPython.utils.io.raw_print``
223 223
224 224
225 225 Backwards incompatible changes
226 226 ------------------------------
227 227
228 228 * The API for transforming input before it is parsed as Python code has been
229 229 completely redesigned, and any custom input transformations will need to be
230 230 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