Show More
@@ -1,181 +1,220 b'' | |||
|
1 | 1 | ===================== |
|
2 | 2 | Development version |
|
3 | 3 | ===================== |
|
4 | 4 | |
|
5 | 5 | This document describes in-flight development work. |
|
6 | 6 | |
|
7 | 7 | .. warning:: |
|
8 | 8 | |
|
9 | 9 | Please do not edit this file by hand (doing so will likely cause merge |
|
10 | 10 | conflicts for other Pull Requests). Instead, create a new file in the |
|
11 | 11 | `docs/source/whatsnew/pr` folder |
|
12 | 12 | |
|
13 | 13 | |
|
14 | 14 | Released .... ...., 2019 |
|
15 | 15 | |
|
16 | 16 | |
|
17 | 17 | Need to be updated: |
|
18 | 18 | |
|
19 | 19 | .. toctree:: |
|
20 | 20 | :maxdepth: 2 |
|
21 | 21 | :glob: |
|
22 | 22 | |
|
23 | 23 | pr/* |
|
24 | 24 | |
|
25 | IPython 8.0 is bringing a number of new features and improvements to both the | |
|
25 | IPython 8.0 is bringing a large number of new features and improvements to both the | |
|
26 | 26 | user of the terminal and of the kernel via Jupyter. The removal of compatibility |
|
27 | 27 | with older version of Python is also the opportunity to do a couple of |
|
28 | 28 | performance improvement in particular with respect to startup time. |
|
29 | 29 | |
|
30 | The main change in IPython 8.0 is the integration of the ``stack_data`` package; | |
|
30 | This release contains 250+ Pull requests, in addition to many of the features | |
|
31 | and backports that have made it to the 7.x branch. | |
|
32 | ||
|
33 | We removed almost all features, arguments, functions, and modules that were | |
|
34 | marked as deprecated between IPython 1.0 and 5.0 and before. As reminder 5.0 was | |
|
35 | released in 2016, and 1.0 in 2013. Last release of the 5 branch was 5.10.0, in | |
|
36 | may 2020. The few remaining deprecated features have better deprecation warnings | |
|
37 | or errors. | |
|
38 | ||
|
39 | There are many change in IPython 8.0 will will try to describe subsequently, | |
|
40 | ||
|
41 | ||
|
42 | The first on is the integration of the ``stack_data`` package; | |
|
31 | 43 | which provide smarter information in traceback; in particular it will highlight |
|
32 | 44 | the AST node where an error occurs which can help to quickly narrow down errors. |
|
33 | 45 | |
|
34 | 46 | For example in the following snippet:: |
|
35 | 47 | |
|
36 | 48 | def foo(i): |
|
37 | 49 | x = [[[0]]] |
|
38 | 50 | return x[0][i][0] |
|
39 | 51 | |
|
40 | 52 | |
|
41 | 53 | def bar(): |
|
42 | 54 | return foo(0) + foo( |
|
43 | 55 | 1 |
|
44 | 56 | ) + foo(2) |
|
45 | 57 | |
|
46 | 58 | |
|
47 | 59 | Calling ``bar()`` would raise an ``IndexError`` on the return line of ``foo``, |
|
48 | 60 | IPython 8.0 is capable of telling you, where the index error occurs:: |
|
49 | 61 | |
|
50 | 62 | return x[0][i][0] |
|
51 | 63 | ^ |
|
52 | 64 | |
|
65 | ||
|
66 | Numfocus Small Developer Grant | |
|
67 | ------------------------------ | |
|
68 | ||
|
53 | 69 | To prepare for Python 3.10 we have also started working on removing reliance and |
|
54 | 70 | any dependency that is not Python 3.10 compatible; that include migrating our |
|
55 |
test suite to |
|
|
71 | test suite to pytest, and starting to remove nose. This also mean that the | |
|
72 | ``iptest`` command is now gone, and all testing is via pytest. | |
|
73 | ||
|
74 | This was in bog part thanks the NumFOCUS Small Developer grant, we were able to | |
|
75 | allocate 4000 to hire `Nikita Kniazev @Kojoley <https://github.com/Kojoley>`__ | |
|
76 | who did a fantastic job at updating our code base, migrating to pytest, pushing | |
|
77 | our coverage, and fixing a large number of bugs. I highly recommend contacting | |
|
78 | them if you need help with C++ and Python projects | |
|
56 | 79 | |
|
57 | We are also removing support for Python 3.6 allowing internal code to use more | |
|
80 | You can find all relevant issues and PRs with the SDG 2021 tag: | |
|
81 | ||
|
82 | https://github.com/ipython/ipython/issues?q=label%3A%22Numfocus+SDG+2021%22+ | |
|
83 | ||
|
84 | Removing support for Older Python | |
|
85 | --------------------------------- | |
|
86 | ||
|
87 | ||
|
88 | We are also removing support for Python up to 3.7 allowing internal code to use more | |
|
58 | 89 | efficient ``pathlib``, and make better use of type annotations. |
|
59 | 90 | |
|
91 | IMAGE : Pathlib, pathlib everywhere. | |
|
92 | ||
|
60 | 93 | The completer has also seen significant updates and make use of newer Jedi API |
|
61 | 94 | offering faster and more reliable tab completion. |
|
62 | 95 | |
|
63 | 96 | For the terminal users this also enable the auto-suggestion feature, described |
|
64 | 97 | below, which show "ghost text" ahead of your cursor you can accept without |
|
65 | 98 | having to press the tab key or ask the completer to suggest completions. |
|
66 | 99 | |
|
67 | 100 | |
|
68 | 101 | Autosuggestion is a very useful feature available in `fish <https://fishshell.com/>`__, `zsh <https://en.wikipedia.org/wiki/Z_shell>`__, and `prompt-toolkit <https://python-prompt-toolkit.readthedocs.io/en/master/pages/asking_for_input.html#auto-suggestion>`__. |
|
69 | 102 | |
|
70 | 103 | `Ptpython <https://github.com/prompt-toolkit/ptpython#ptpython>`__ allows users to enable this feature in |
|
71 | 104 | `ptpython/config.py <https://github.com/prompt-toolkit/ptpython/blob/master/examples/ptpython_config/config.py#L90>`__. |
|
72 | 105 | |
|
73 | 106 | This feature allows users to accept autosuggestions with ctrl e, ctrl f, |
|
74 | 107 | or right arrow as described below. |
|
75 | 108 | |
|
76 | 109 | 1. Start ipython |
|
77 | 110 | |
|
78 | 111 | .. image:: ../_images/auto_suggest_prompt_no_text.png |
|
79 | 112 | |
|
80 | 113 | 2. Run ``print("hello")`` |
|
81 | 114 | |
|
82 | 115 | .. image:: ../_images/auto_suggest_print_hello_suggest.png |
|
83 | 116 | |
|
84 | 117 | 3. Press p to see the autosuggestion |
|
85 | 118 | |
|
86 | 119 | .. image:: ../_images/auto_suggest_print_hello_suggest.png |
|
87 | 120 | |
|
88 | 121 | 4. Press ctrl f, or ctrl e, or right arrow to accept the suggestion |
|
89 | 122 | |
|
90 | 123 | .. image:: ../_images/auto_suggest_print_hello.png |
|
91 | 124 | |
|
92 | 125 | You can also complete word by word: |
|
93 | 126 | |
|
94 | 127 | 1. Run ``def say_hello(): print("hello")`` |
|
95 | 128 | |
|
96 | 129 | .. image:: ../_images/auto_suggest_second_prompt.png |
|
97 | 130 | |
|
98 | 131 | 2. Press d to see the autosuggestion |
|
99 | 132 | |
|
100 | 133 | .. image:: ../_images/audo_suggest_d_phantom.png |
|
101 | 134 | |
|
102 | 135 | 3. Press alt f to accept the first word of the suggestion |
|
103 | 136 | |
|
104 | 137 | .. image:: ../_images/auto_suggest_def_phantom.png |
|
105 | 138 | |
|
106 | 139 | Importantly, this feature does not interfere with tab completion: |
|
107 | 140 | |
|
108 | 141 | 1. After running ``def say_hello(): print("hello")``, press d |
|
109 | 142 | |
|
110 | 143 | .. image:: ../_images/audo_suggest_d_phantom.png |
|
111 | 144 | |
|
112 | 145 | 2. Press Tab to start tab completion |
|
113 | 146 | |
|
114 | 147 | .. image:: ../_images/auto_suggest_d_completions.png |
|
115 | 148 | |
|
116 | 149 | 3A. Press Tab again to select the first option |
|
117 | 150 | |
|
118 | 151 | .. image:: ../_images/auto_suggest_def_completions.png |
|
119 | 152 | |
|
120 | 153 | 3B. Press alt f to accept to accept the first word of the suggestion |
|
121 | 154 | |
|
122 | 155 | .. image:: ../_images/auto_suggest_def_phantom.png |
|
123 | 156 | |
|
124 | 157 | 3C. Press ctrl f or ctrl e to accept the entire suggestion |
|
125 | 158 | |
|
126 | 159 | .. image:: ../_images/auto_suggest_match_parens.png |
|
127 | 160 | |
|
128 | 161 | To install a version of ipython with autosuggestions enabled, run: |
|
129 | 162 | |
|
130 | 163 | ``pip install git+https://github.com/mskar/ipython@auto_suggest`` |
|
131 | 164 | |
|
132 | 165 | Currently, autosuggestions are only shown in the emacs or vi insert editing modes: |
|
133 | 166 | |
|
134 | 167 | - The ctrl e, ctrl f, and alt f shortcuts work by default in emacs mode. |
|
135 | 168 | - To use these shortcuts in vi insert mode, you will have to create `custom keybindings in your config.py <https://github.com/mskar/setup/commit/2892fcee46f9f80ef7788f0749edc99daccc52f4/>`__. |
|
136 | 169 | |
|
137 | 170 | |
|
138 | 171 | Show pinfo information in ipdb using "?" and "??" |
|
139 | 172 | ------------------------------------------------- |
|
140 | 173 | |
|
141 | 174 | In IPDB, it is now possible to show the information about an object using "?" |
|
142 | 175 | and "??", in much the same way it can be done when using the IPython prompt:: |
|
143 | 176 | |
|
144 | 177 | ipdb> partial? |
|
145 | 178 | Init signature: partial(self, /, *args, **kwargs) |
|
146 | 179 | Docstring: |
|
147 | 180 | partial(func, *args, **keywords) - new function with partial application |
|
148 | 181 | of the given arguments and keywords. |
|
149 | 182 | File: ~/.pyenv/versions/3.8.6/lib/python3.8/functools.py |
|
150 | 183 | Type: type |
|
151 | 184 | Subclasses: |
|
152 | 185 | |
|
153 | 186 | Previously, "pinfo" or "pinfo2" command had to be used for this purpose. |
|
154 | 187 | |
|
155 | 188 | |
|
156 | 189 | Autoreload 3 feature |
|
157 | 190 | ==================== |
|
158 | 191 | |
|
159 | 192 | Example: When an IPython session is ran with the 'autoreload' extension loaded, |
|
160 | 193 | you will now have the option '3' to select which means the following: |
|
161 | 194 | |
|
162 | 195 | 1. replicate all functionality from option 2 |
|
163 | 196 | 2. autoload all new funcs/classes/enums/globals from the module when they're added |
|
164 | 197 | 3. autoload all newly imported funcs/classes/enums/globals from external modules |
|
165 | 198 | |
|
166 | 199 | Try ``%autoreload 3`` in an IPython session after running ``%load_ext autoreload`` |
|
167 | 200 | |
|
168 | 201 | For more information please see unit test - |
|
169 | 202 | extensions/tests/test_autoreload.py : 'test_autoload_newly_added_objects' |
|
170 | 203 | |
|
204 | ||
|
205 | Miscelanious | |
|
206 | ------------ | |
|
207 | ||
|
208 | Minimum supported | |
|
209 | ||
|
171 | 210 | ======= |
|
172 | 211 | |
|
173 | 212 | .. DO NOT EDIT THIS LINE BEFORE RELEASE. FEATURE INSERTION POINT. |
|
174 | 213 | |
|
175 | 214 | As a reminder, IPython master has diverged from the 7.x branch, thus master may |
|
176 | 215 | have more feature and API changes. |
|
177 | 216 | |
|
178 | 217 | Backwards incompatible changes |
|
179 | 218 | ------------------------------ |
|
180 | 219 | |
|
181 | 220 | .. DO NOT EDIT THIS LINE BEFORE RELEASE. INCOMPAT INSERTION POINT. |
General Comments 0
You need to be logged in to leave comments.
Login now