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