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