Show More
@@ -1,321 +1,322 | |||
|
1 | 1 | .. _core_developer_guide: |
|
2 | 2 | |
|
3 | 3 | ================================= |
|
4 | 4 | Guide for IPython core Developers |
|
5 | 5 | ================================= |
|
6 | 6 | |
|
7 | 7 | This guide documents the development of IPython itself. Alternatively, |
|
8 | 8 | developers of third party tools and libraries that use IPython should see the |
|
9 | 9 | :doc:`../development/index`. |
|
10 | 10 | |
|
11 | 11 | |
|
12 | 12 | For instructions on how to make a developer install see :ref:`devinstall`. |
|
13 | 13 | |
|
14 | 14 | Backporting Pull requests |
|
15 | 15 | ------------------------- |
|
16 | 16 | |
|
17 | 17 | All pull requests should usually be made against ``master``, if a Pull Request |
|
18 | 18 | need to be backported to an earlier release; then it should be tagged with the |
|
19 | 19 | correct ``milestone``. |
|
20 | 20 | |
|
21 | 21 | If you tag a pull request with a milestone **before** merging the pull request, |
|
22 | and the base ref is `master`, then our backport bot should automatically create | |
|
22 | and the base ref is ``master``, then our backport bot should automatically create | |
|
23 | 23 | a corresponding pull-request that backport on the correct branch. |
|
24 | 24 | |
|
25 |
If you |
|
|
25 | If you have write access to the IPython repository you can also just mention the | |
|
26 | 26 | **backport bot** to do the work for you. The bot is evolving so instructions may |
|
27 | 27 | be different. At the time of this writing you can use:: |
|
28 | 28 | |
|
29 |
@meeseeksdev[bot] backport [to <branchname> |
|
|
29 | @meeseeksdev[bot] backport [to] <branchname> | |
|
30 | 30 | |
|
31 | 31 | The bot will attempt to backport the current pull-request and issue a PR if |
|
32 | possible. If the milestone is set on the issue you can omit the branch to | |
|
33 | backport to. | |
|
32 | possible. | |
|
34 | 33 | |
|
35 | 34 | .. note:: |
|
36 | 35 | |
|
37 | 36 | The ``@`` and ``[bot]`` when mentioning the bot should be optional and can |
|
38 | 37 | be omitted. |
|
39 | 38 | |
|
40 | 39 | If the pull request cannot be automatically backported, the bot should tell you |
|
41 | 40 | so on the PR and apply a "Need manual backport" tag to the origin PR. |
|
42 | 41 | |
|
43 | 42 | |
|
44 | 43 | Backport with ghpro |
|
45 | 44 | ------------------- |
|
46 | 45 | |
|
47 | 46 | We can also use `ghpro <https://pypi.python.org/pypi/ghpro>`_ |
|
48 | 47 | to automatically list and apply the PR on other branches. For example: |
|
49 | 48 | |
|
50 | 49 | .. code-block:: bash |
|
51 | 50 | |
|
52 | 51 | $ backport-pr todo --milestone 5.2 |
|
53 | 52 | [...snip..] |
|
54 | 53 | The following PRs have been backported |
|
55 | 54 | 9848 |
|
56 | 55 | 9851 |
|
57 | 56 | 9953 |
|
58 | 57 | 9955 |
|
59 | 58 | The following PRs should be backported: |
|
60 | 59 | 9417 |
|
61 | 60 | 9863 |
|
62 | 61 | 9925 |
|
63 | 62 | 9947 |
|
64 | 63 | |
|
65 | 64 | $ backport-pr apply 5.x 9947 |
|
66 | 65 | [...snip...] |
|
67 | 66 | |
|
68 | 67 | |
|
69 | 68 | .. _release_process: |
|
70 | 69 | |
|
71 | 70 | ======================= |
|
72 | 71 | IPython release process |
|
73 | 72 | ======================= |
|
74 | 73 | |
|
75 | 74 | This document contains the process that is used to create an IPython release. |
|
76 | 75 | |
|
77 | 76 | Conveniently, the ``release`` script in the ``tools`` directory of the ``IPython`` |
|
78 | 77 | repository automates most of the release process. This document serves as a |
|
79 | 78 | handy reminder and checklist for the release manager. |
|
80 | 79 | |
|
81 | 80 | During the release process, you might need the extra following dependencies: |
|
82 | 81 | |
|
83 | 82 | - ``keyring`` to access your GitHub authentication tokens |
|
84 | 83 | - ``graphviz`` to generate some graphs in the documentation |
|
85 | 84 | - ``ghpro`` to generate the stats |
|
86 | 85 | |
|
87 | 86 | Make sure you have all the required dependencies to run the tests as well. |
|
88 | 87 | |
|
89 | 88 | |
|
90 | 89 | 1. Set Environment variables |
|
91 | 90 | ---------------------------- |
|
92 | 91 | |
|
93 | 92 | Set environment variables to document previous release tag, current |
|
94 | 93 | release milestone, current release version, and git tag. |
|
95 | 94 | |
|
96 | 95 | These variables may be used later to copy/paste as answers to the script |
|
97 | 96 | questions instead of typing the appropriate command when the time comes. These |
|
98 | 97 | variables are not used by the scripts directly; therefore, there is no need to |
|
99 | 98 | ``export`` them. The format for bash is as follows, but note that these values |
|
100 | 99 | are just an example valid only for the 5.0 release; you'll need to update them |
|
101 | 100 | for the release you are actually making:: |
|
102 | 101 | |
|
103 | 102 | PREV_RELEASE=4.2.1 |
|
104 | 103 | MILESTONE=5.0 |
|
105 | 104 | VERSION=5.0.0 |
|
106 | 105 | BRANCH=master |
|
107 | 106 | |
|
108 | 107 | |
|
109 | 108 | 2. Create GitHub stats and finish release note |
|
110 | 109 | ---------------------------------------------- |
|
111 | 110 | |
|
112 | 111 | .. note:: |
|
113 | 112 | |
|
114 | 113 | This step is optional if making a Beta or RC release. |
|
115 | 114 | |
|
116 | 115 | .. note:: |
|
117 | 116 | |
|
118 | 117 | Before generating the GitHub stats, verify that all closed issues and pull |
|
119 | 118 | requests have `appropriate milestones |
|
120 | 119 | <https://github.com/ipython/ipython/wiki/Dev:-GitHub-workflow#milestones>`_. |
|
121 | 120 | `This search |
|
122 | 121 | <https://github.com/ipython/ipython/issues?q=is%3Aclosed+no%3Amilestone+is%3Aissue>`_ |
|
123 | 122 | should return no results before creating the GitHub stats. |
|
124 | 123 | |
|
125 | 124 | If a major release: |
|
126 | 125 | |
|
127 | 126 | - merge any pull request notes into what's new:: |
|
128 | 127 | |
|
129 | 128 | python tools/update_whatsnew.py |
|
130 | 129 | |
|
131 | 130 | - update ``docs/source/whatsnew/development.rst``, to ensure it covers |
|
132 | 131 | the major release features |
|
133 | 132 | |
|
134 | 133 | - move the contents of ``development.rst`` to ``versionX.rst`` where ``X`` is |
|
135 | 134 | the numerical release version |
|
136 | 135 | |
|
137 | 136 | - generate summary of GitHub contributions, which can be done with:: |
|
138 | 137 | |
|
139 | 138 | python tools/github_stats.py --milestone $MILESTONE > stats.rst |
|
140 | 139 | |
|
141 | 140 | which may need some manual cleanup of ``stats.rst``. Add the cleaned |
|
142 | 141 | ``stats.rst`` results to ``docs/source/whatsnew/github-stats-X.rst`` |
|
143 | 142 | where ``X`` is the numerical release version (don't forget to add it to |
|
144 | 143 | the git repository as well). If creating a major release, make a new |
|
145 | 144 | ``github-stats-X.rst`` file; if creating a minor release, the content |
|
146 | 145 | from ``stats.rst`` may simply be added to the top of an existing |
|
147 | 146 | ``github-stats-X.rst`` file. |
|
148 | 147 | |
|
149 | 148 | - Edit ``docs/source/whatsnew/index.rst`` to list the new ``github-stats-X`` |
|
150 | 149 | file you just created. |
|
151 | 150 | |
|
152 | - Remove temporarily the first entry called ``development`` (you'll need to | |
|
153 | add it back after release). | |
|
151 | - You do not need to temporarily remove the first entry called | |
|
152 | ``development``, nor re-add it after the release, it will automatically be | |
|
153 | hidden when releasing a stable version of IPython (if ``_version_extra`` | |
|
154 | in ``release.py`` is an empty string. | |
|
154 | 155 | |
|
155 | 156 | Make sure that the stats file has a header or it won't be rendered in |
|
156 | 157 | the final documentation. |
|
157 | 158 | |
|
158 | 159 | To find duplicates and update `.mailmap`, use:: |
|
159 | 160 | |
|
160 | 161 | git log --format="%aN <%aE>" $PREV_RELEASE... | sort -u -f |
|
161 | 162 | |
|
162 | 163 | If a minor release you might need to do some of the above points manually, and |
|
163 | 164 | forward port the changes. |
|
164 | 165 | |
|
165 | 166 | 3. Make sure the repository is clean |
|
166 | 167 | ------------------------------------ |
|
167 | 168 | |
|
168 | 169 | of any file that could be problematic. |
|
169 | 170 | Remove all non-tracked files with: |
|
170 | 171 | |
|
171 | 172 | .. code:: |
|
172 | 173 | |
|
173 | 174 | git clean -xfdi |
|
174 | 175 | |
|
175 | 176 | This will ask for confirmation before removing all untracked files. Make |
|
176 | 177 | sure the ``dist/`` folder is clean to avoid any stale builds from |
|
177 | 178 | previous build attempts. |
|
178 | 179 | |
|
179 | 180 | |
|
180 | 181 | 4. Update the release version number |
|
181 | 182 | ------------------------------------ |
|
182 | 183 | |
|
183 | 184 | Edit ``IPython/core/release.py`` to have the current version. |
|
184 | 185 | |
|
185 | 186 | in particular, update version number and ``_version_extra`` content in |
|
186 | 187 | ``IPython/core/release.py``. |
|
187 | 188 | |
|
188 | 189 | Step 5 will validate your changes automatically, but you might still want to |
|
189 | 190 | make sure the version number matches pep440. |
|
190 | 191 | |
|
191 | 192 | In particular, ``rc`` and ``beta`` are not separated by ``.`` or the ``sdist`` |
|
192 | 193 | and ``bdist`` will appear as different releases. For example, a valid version |
|
193 | 194 | number for a release candidate (rc) release is: ``1.3rc1``. Notice that there |
|
194 | 195 | is no separator between the '3' and the 'r'. Check the environment variable |
|
195 | 196 | ``$VERSION`` as well. |
|
196 | 197 | |
|
197 | 198 | You will likely just have to modify/comment/uncomment one of the lines setting |
|
198 | 199 | ``_version_extra`` |
|
199 | 200 | |
|
200 | 201 | |
|
201 | 202 | 5. Run the `tools/build_release` script |
|
202 | 203 | --------------------------------------- |
|
203 | 204 | |
|
204 | 205 | Running ``tools/build_release`` does all the file checking and building that |
|
205 | 206 | the real release script will do. This makes test installations, checks that |
|
206 | 207 | the build procedure runs OK, and tests other steps in the release process. |
|
207 | 208 | |
|
208 | 209 | The ``build_release`` script will in particular verify that the version number |
|
209 | 210 | match PEP 440, in order to avoid surprise at the time of build upload. |
|
210 | 211 | |
|
211 | 212 | We encourage creating a test build of the docs as well. |
|
212 | 213 | |
|
213 | 214 | 6. Create and push the new tag |
|
214 | 215 | ------------------------------ |
|
215 | 216 | |
|
216 | 217 | Commit the changes to release.py:: |
|
217 | 218 | |
|
218 | 219 | git commit -am "release $VERSION" |
|
219 | 220 | git push origin $BRANCH |
|
220 | 221 | |
|
221 | 222 | Create and push the tag:: |
|
222 | 223 | |
|
223 | 224 | git tag -am "release $VERSION" "$VERSION" |
|
224 | 225 | git push origin --tags |
|
225 | 226 | |
|
226 | 227 | Update release.py back to ``x.y-dev`` or ``x.y-maint``, and re-add the |
|
227 | 228 | ``development`` entry in ``docs/source/whatsnew/index.rst`` and push:: |
|
228 | 229 | |
|
229 | 230 | git commit -am "back to development" |
|
230 | 231 | git push origin $BRANCH |
|
231 | 232 | |
|
232 | 233 | Now checkout the tag we just made:: |
|
233 | 234 | |
|
234 | 235 | git checkout $VERSION |
|
235 | 236 | |
|
236 | 237 | 7. Run the release script |
|
237 | 238 | ------------------------- |
|
238 | 239 | |
|
239 | 240 | Run the ``release`` script, this step requires having a current wheel, Python |
|
240 | 241 | >=3.4 and Python 2.7.:: |
|
241 | 242 | |
|
242 | 243 | ./tools/release |
|
243 | 244 | |
|
244 | 245 | This makes the tarballs and wheels, and puts them under the ``dist/`` |
|
245 | 246 | folder. Be sure to test the ``wheels`` and the ``sdist`` locally before |
|
246 | 247 | uploading them to PyPI. We do not use an universal wheel as each wheel |
|
247 | 248 | installs an ``ipython2`` or ``ipython3`` script, depending on the version of |
|
248 | 249 | Python it is built for. Using an universal wheel would prevent this. |
|
249 | 250 | |
|
250 | 251 | Use the following to actually upload the result of the build:: |
|
251 | 252 | |
|
252 | 253 | ./tools/release upload |
|
253 | 254 | |
|
254 | 255 | It should posts them to ``archive.ipython.org`` and to PyPI. |
|
255 | 256 | |
|
256 | 257 | PyPI/Warehouse will automatically hide previous releases. If you are uploading |
|
257 | 258 | a non-stable version, make sure to log-in to PyPI and un-hide previous version. |
|
258 | 259 | |
|
259 | 260 | |
|
260 | 261 | 8. Draft a short release announcement |
|
261 | 262 | ------------------------------------- |
|
262 | 263 | |
|
263 | 264 | The announcement should include: |
|
264 | 265 | |
|
265 | 266 | - release highlights |
|
266 | 267 | - a link to the html version of the *What's new* section of the documentation |
|
267 | 268 | - a link to upgrade or installation tips (if necessary) |
|
268 | 269 | |
|
269 | 270 | Post the announcement to the mailing list and or blog, and link from Twitter. |
|
270 | 271 | |
|
271 | 272 | .. note:: |
|
272 | 273 | |
|
273 | 274 | If you are doing a RC or Beta, you can likely skip the next steps. |
|
274 | 275 | |
|
275 | 276 | 9. Update milestones on GitHub |
|
276 | 277 | ------------------------------- |
|
277 | 278 | |
|
278 | 279 | These steps will bring milestones up to date: |
|
279 | 280 | |
|
280 | 281 | - close the just released milestone |
|
281 | 282 | - open a new milestone for the next release (x, y+1), if the milestone doesn't |
|
282 | 283 | exist already |
|
283 | 284 | |
|
284 | 285 | 10. Update the IPython website |
|
285 | 286 | ------------------------------ |
|
286 | 287 | |
|
287 | 288 | The IPython website should document the new release: |
|
288 | 289 | |
|
289 | 290 | - add release announcement (news, announcements) |
|
290 | 291 | - update current version and download links |
|
291 | 292 | - update links on the documentation page (especially if a major release) |
|
292 | 293 | |
|
293 | 294 | 11. Update readthedocs |
|
294 | 295 | ---------------------- |
|
295 | 296 | |
|
296 | 297 | Make sure to update readthedocs and set the latest tag as stable, as well as |
|
297 | 298 | checking that previous release is still building under its own tag. |
|
298 | 299 | |
|
299 | 300 | 12. Update the Conda-Forge feedstock |
|
300 | 301 | ------------------------------------ |
|
301 | 302 | |
|
302 | 303 | Follow the instructions on `the repository <https://github.com/conda-forge/ipython-feedstock>`_ |
|
303 | 304 | |
|
304 | 305 | 13. Celebrate! |
|
305 | 306 | -------------- |
|
306 | 307 | |
|
307 | 308 | Celebrate the release and please thank the contributors for their work. Great |
|
308 | 309 | job! |
|
309 | 310 | |
|
310 | 311 | |
|
311 | 312 | |
|
312 | 313 | Old Documentation |
|
313 | 314 | ================= |
|
314 | 315 | |
|
315 | 316 | Out of date documentation is still available and have been kept for archival purposes. |
|
316 | 317 | |
|
317 | 318 | .. note:: |
|
318 | 319 | |
|
319 | 320 | Developers documentation used to be on the IPython wiki, but are now out of |
|
320 | 321 | date. The wiki is though still available for historical reasons: `Old IPython |
|
321 | 322 | GitHub Wiki. <https://github.com/ipython/ipython/wiki/Dev:-Index>`_ |
@@ -1,46 +1,62 | |||
|
1 | 1 | .. Developers should add in this file, during each release cycle, information |
|
2 | 2 | .. about important changes they've made, in a summary format that's meant for |
|
3 | 3 | .. end users. For each release we normally have three sections: features, bug |
|
4 | 4 | .. fixes and api breakage. |
|
5 | 5 | .. Please remember to credit the authors of the contributions by name, |
|
6 | 6 | .. especially when they are new users or developers who do not regularly |
|
7 | 7 | .. participate in IPython's development. |
|
8 | 8 | |
|
9 | 9 | .. _whatsnew_index: |
|
10 | 10 | |
|
11 | 11 | ===================== |
|
12 | 12 | What's new in IPython |
|
13 | 13 | ===================== |
|
14 | 14 | |
|
15 | .. this will appear in the docs if we are nto releasing a versin (ie is | |
|
16 | .. _version_extra in release.py is empty stringA | |
|
17 | ||
|
18 | .. only:: ipydev | |
|
19 | ||
|
20 | Developpement version in-progress features: | |
|
21 | ||
|
22 | .. toctree:: | |
|
23 | development | |
|
24 | ||
|
25 | .. this make a hidden toctree that avoid sphinx to complain about documents | |
|
26 | .. included nowhere when building docs for stable | |
|
27 | .. only:: ipystable | |
|
28 | .. toctree:: | |
|
29 | :hidden: | |
|
30 | development | |
|
31 | ||
|
15 | 32 | This section documents the changes that have been made in various versions of |
|
16 | 33 | IPython. Users should consult these pages to learn about new features, bug |
|
17 | 34 | fixes and backwards incompatibilities. Developers should summarize the |
|
18 | 35 | development work they do here in a user friendly format. |
|
19 | 36 | |
|
20 | 37 | .. toctree:: |
|
21 | 38 | :maxdepth: 1 |
|
22 | 39 | |
|
23 | development | |
|
24 | 40 | version7 |
|
25 | 41 | version6 |
|
26 | 42 | github-stats-6 |
|
27 | 43 | version5 |
|
28 | 44 | github-stats-5 |
|
29 | 45 | version4 |
|
30 | 46 | github-stats-4 |
|
31 | 47 | version3 |
|
32 | 48 | github-stats-3 |
|
33 | 49 | version3_widget_migration |
|
34 | 50 | version2.0 |
|
35 | 51 | github-stats-2.0 |
|
36 | 52 | version1.0 |
|
37 | 53 | github-stats-1.0 |
|
38 | 54 | version0.13 |
|
39 | 55 | github-stats-0.13 |
|
40 | 56 | version0.12 |
|
41 | 57 | github-stats-0.12 |
|
42 | 58 | version0.11 |
|
43 | 59 | github-stats-0.11 |
|
44 | 60 | version0.10 |
|
45 | 61 | version0.9 |
|
46 | 62 | version0.8 |
@@ -1,214 +1,215 | |||
|
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 | .. warning:: |
|
11 | 11 | |
|
12 | 12 | IPython 7.0 is currently in Beta, Feedback on API/changes and |
|
13 | 13 | addition/updates to this cahngelog are welcomed. |
|
14 | 14 | |
|
15 | 15 | Released .... ...., 2017 |
|
16 | 16 | |
|
17 | 17 | IPython 7 include major features improvement as you can read in the following |
|
18 | 18 | changelog. This is also the second major version of IPython to stop support only |
|
19 | 19 | Python 3 βΒ starting at Python 3.4. Python 2 is still still community supported |
|
20 | 20 | on the bugfix only 5.x branch, but we remind you that Python 2 EOL is Jan 1st |
|
21 | 21 | 2020. |
|
22 | 22 | |
|
23 | 23 | We were able to backport bug fixes to the 5.x branch thanks to our backport bot which |
|
24 | 24 | backported more than `70 Pull-Requests |
|
25 | 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 | 27 | IPython 6.x branch will likely not see any further release unless we critical |
|
28 | 28 | bugs are found. |
|
29 | 29 | |
|
30 | 30 | Make sure you have pip > 9.0 before upgrading. You should be able to update by simply runngin |
|
31 | 31 | |
|
32 | 32 | .. code:: |
|
33 | 33 | |
|
34 | 34 | pip install ipython --upgrade |
|
35 | 35 | |
|
36 | 36 | Or if you have conda installed: |
|
37 | 37 | |
|
38 | 38 | .. code:: |
|
39 | 39 | |
|
40 | 40 | conda install ipython |
|
41 | 41 | |
|
42 | 42 | |
|
43 | 43 | |
|
44 | 44 | Prompt Toolkit 2.0 |
|
45 | 45 | ------------------ |
|
46 | 46 | |
|
47 | 47 | IPython 7.0+ now use ``prompt_toolkit 2.0``, if you still need to use earlier |
|
48 | 48 | ``prompt_toolkit`` version you may need to pin IPython to ``<7.0``. |
|
49 | 49 | |
|
50 | 50 | Autowait: Asynchronous REPL |
|
51 | 51 | --------------------------- |
|
52 | 52 | |
|
53 | 53 | Staring with IPython 7.0 and on Python 3.6+, IPython can automatically await |
|
54 | 54 | code at top level, you should not need to access an event loop or runner |
|
55 | 55 | yourself. To know more read the :ref:`autoawait` section of our docs, see |
|
56 | 56 | :ghpull:`11265` or try the following code:: |
|
57 | 57 | |
|
58 | 58 | Python 3.6.0 |
|
59 | 59 | Type 'copyright', 'credits' or 'license' for more information |
|
60 | 60 | IPython 7.0.0 -- An enhanced Interactive Python. Type '?' for help. |
|
61 | 61 | |
|
62 | 62 | In [1]: import aiohttp |
|
63 | 63 | ...: result = aiohttp.get('https://api.github.com') |
|
64 | 64 | |
|
65 | 65 | In [2]: response = await result |
|
66 | 66 | <pause for a few 100s ms> |
|
67 | 67 | |
|
68 | 68 | In [3]: await response.json() |
|
69 | 69 | Out[3]: |
|
70 | 70 | {'authorizations_url': 'https://api.github.com/authorizations', |
|
71 | 71 | 'code_search_url': 'https://api.github.com/search/code?q={query}{&page,per_page,sort,order}', |
|
72 | 72 | ... |
|
73 | 73 | } |
|
74 | 74 | |
|
75 | 75 | .. note:: |
|
76 | 76 | |
|
77 | 77 | Async integration is experimental code, behavior may change or be removed |
|
78 | 78 | between Python and IPython versions without warnings. |
|
79 | 79 | |
|
80 | 80 | Integration is by default with `asyncio`, but other libraries can be configured, |
|
81 | 81 | like ``curio`` or ``trio``, to improve concurrency in the REPL:: |
|
82 | 82 | |
|
83 | 83 | In [1]: %autoawait trio |
|
84 | 84 | |
|
85 | 85 | In [2]: import trio |
|
86 | 86 | |
|
87 | 87 | In [3]: async def child(i): |
|
88 | 88 | ...: print(" child %s goes to sleep"%i) |
|
89 | 89 | ...: await trio.sleep(2) |
|
90 | 90 | ...: print(" child %s wakes up"%i) |
|
91 | 91 | |
|
92 | 92 | In [4]: print('parent start') |
|
93 | 93 | ...: async with trio.open_nursery() as n: |
|
94 | 94 | ...: for i in range(3): |
|
95 | 95 | ...: n.spawn(child, i) |
|
96 | 96 | ...: print('parent end') |
|
97 | 97 | parent start |
|
98 | 98 | child 2 goes to sleep |
|
99 | 99 | child 0 goes to sleep |
|
100 | 100 | child 1 goes to sleep |
|
101 | 101 | <about 2 seconds pause> |
|
102 | 102 | child 2 wakes up |
|
103 | 103 | child 1 wakes up |
|
104 | 104 | child 0 wakes up |
|
105 | 105 | parent end |
|
106 | 106 | |
|
107 | 107 | See :ref:`autoawait` for more information. |
|
108 | 108 | |
|
109 | 109 | |
|
110 | 110 | Asynchronous code in a Notebook interface or any other frontend using the |
|
111 | 111 | Jupyter Protocol will need further updates of the IPykernel package. |
|
112 | 112 | |
|
113 | 113 | Non-Asynchronous code |
|
114 | 114 | ~~~~~~~~~~~~~~~~~~~~~ |
|
115 | 115 | |
|
116 | 116 | As the internal API of IPython are now asynchronous, IPython need to run under |
|
117 | 117 | an even loop. In order to allow many workflow, (like using the ``%run`` magic, |
|
118 | 118 | or copy_pasting code that explicitly starts/stop event loop), when top-level code |
|
119 | 119 | is detected as not being asynchronous, IPython code is advanced via a |
|
120 | 120 | pseudo-synchronous runner, and will not may not advance pending tasks. |
|
121 | 121 | |
|
122 | 122 | Change to Nested Embed |
|
123 | 123 | ~~~~~~~~~~~~~~~~~~~~~~ |
|
124 | 124 | |
|
125 | 125 | The introduction of the ability to run async code had some effect on the |
|
126 | 126 | ``IPython.embed()`` API. By default embed will not allow you to run asynchronous |
|
127 | 127 | code unless a event loop is specified. |
|
128 | 128 | |
|
129 | 129 | Effects on Magics |
|
130 | 130 | ~~~~~~~~~~~~~~~~~ |
|
131 | 131 | |
|
132 | 132 | Some magics will not work with Async, and will need updates. Contribution |
|
133 | 133 | welcome. |
|
134 | 134 | |
|
135 | 135 | Expected Future changes |
|
136 | 136 | ~~~~~~~~~~~~~~~~~~~~~~~ |
|
137 | 137 | |
|
138 | 138 | We expect more internal but public IPython function to become ``async``, and |
|
139 | 139 | will likely end up having a persisting event loop while IPython is running. |
|
140 | 140 | |
|
141 | 141 | Thanks |
|
142 | 142 | ~~~~~~ |
|
143 | 143 | |
|
144 | 144 | This took more than a year in the making, and the code was rebased a number of |
|
145 | 145 | time leading to commit authorship that may have been lost in the final |
|
146 | 146 | Pull-Request. Huge thanks to many people for contribution, discussion, code, |
|
147 | 147 | documentation, use-case: dalejung, danielballan, ellisonbg, fperez, gnestor, |
|
148 | 148 | minrk, njsmith, pganssle, tacaswell, takluyver , vidartf ... And many other. |
|
149 | 149 | |
|
150 | 150 | |
|
151 | 151 | Autoreload Improvment |
|
152 | 152 | --------------------- |
|
153 | 153 | |
|
154 | 154 | The magic ``%autoreload 2`` now captures new methods added to classes. Earlier, only methods existing as of the initial import were being tracked and updated. |
|
155 | 155 | |
|
156 | 156 | This new feature helps dual environment development - Jupyter+IDE - where the code gradually moves from notebook cells to package files, as it gets structured. |
|
157 | 157 | |
|
158 | 158 | **Example**: An instance of the class `MyClass` will be able to access the method `cube()` after it is uncommented and the file `file1.py` saved on disk. |
|
159 | 159 | |
|
160 | 160 | |
|
161 | 161 | ..code:: |
|
162 | 162 | |
|
163 | 163 | # notebook |
|
164 | 164 | |
|
165 | 165 | from mymodule import MyClass |
|
166 | 166 | first = MyClass(5) |
|
167 | 167 | |
|
168 | 168 | .. code:: |
|
169 | ||
|
169 | 170 | # mymodule/file1.py |
|
170 | 171 | |
|
171 | 172 | class MyClass: |
|
172 | 173 | |
|
173 | 174 | def __init__(self, a=10): |
|
174 | 175 | self.a = a |
|
175 | 176 | |
|
176 | 177 | def square(self): |
|
177 | 178 | print('compute square') |
|
178 | 179 | return self.a*self.a |
|
179 | 180 | |
|
180 | 181 | # def cube(self): |
|
181 | 182 | # print('compute cube') |
|
182 | 183 | # return self.a*self.a*self.a |
|
183 | 184 | |
|
184 | 185 | |
|
185 | 186 | |
|
186 | 187 | |
|
187 | 188 | Misc |
|
188 | 189 | ---- |
|
189 | 190 | |
|
190 | 191 | The autoindent feature that was deprecated in 5.x was re-enabled and |
|
191 | 192 | un-deprecated in :ghpull:`11257` |
|
192 | 193 | |
|
193 | 194 | Make ``%run -n -i ...`` work correctly. Earlier, if ``%run`` was passed both arguments, ``-n`` would be silently ignored. See :ghpull:`10308` |
|
194 | 195 | |
|
195 | 196 | |
|
196 | 197 | |
|
197 | 198 | |
|
198 | 199 | |
|
199 | 200 | Deprecations |
|
200 | 201 | ------------ |
|
201 | 202 | |
|
202 | 203 | A couple of unused function and methods have been deprecated and will be removed |
|
203 | 204 | in future versions: |
|
204 | 205 | |
|
205 | 206 | - ``IPython.utils.io.raw_print_err`` |
|
206 | 207 | - ``IPython.utils.io.raw_print`` |
|
207 | 208 | |
|
208 | 209 | |
|
209 | 210 | Backwards incompatible changes |
|
210 | 211 | ------------------------------ |
|
211 | 212 | |
|
212 | 213 | * The API for transforming input before it is parsed as Python code has been |
|
213 | 214 | completely redesigned, and any custom input transformations will need to be |
|
214 | 215 | 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