Show More
@@ -1,181 +1,181 b'' | |||||
1 | ===================== |
|
1 | ===================== | |
2 | Development version |
|
2 | Development version | |
3 | ===================== |
|
3 | ===================== | |
4 |
|
4 | |||
5 | This document describes in-flight development work. |
|
5 | This document describes in-flight development work. | |
6 |
|
6 | |||
7 | .. warning:: |
|
7 | .. warning:: | |
8 |
|
8 | |||
9 | Please do not edit this file by hand (doing so will likely cause merge |
|
9 | Please do not edit this file by hand (doing so will likely cause merge | |
10 | conflicts for other Pull Requests). Instead, create a new file in the |
|
10 | conflicts for other Pull Requests). Instead, create a new file in the | |
11 | `docs/source/whatsnew/pr` folder |
|
11 | `docs/source/whatsnew/pr` folder | |
12 |
|
12 | |||
13 |
|
13 | |||
14 | Released .... ...., 2019 |
|
14 | Released .... ...., 2019 | |
15 |
|
15 | |||
16 |
|
16 | |||
17 | Need to be updated: |
|
17 | Need to be updated: | |
18 |
|
18 | |||
19 | .. toctree:: |
|
19 | .. toctree:: | |
20 | :maxdepth: 2 |
|
20 | :maxdepth: 2 | |
21 | :glob: |
|
21 | :glob: | |
22 |
|
22 | |||
23 | pr/* |
|
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 number of new features and improvements to both the | |
26 | user of the terminal and of the kernel via Jupyter. The removal of compatibility |
|
26 | user of the terminal and of the kernel via Jupyter. The removal of compatibility | |
27 | with older version of Python is also the opportunity to do a couple of |
|
27 | with older version of Python is also the opportunity to do a couple of | |
28 | performance improvement in particular with respect to startup time. |
|
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 | The main change in IPython 8.0 is the integration of the ``stack_data`` package; | |
31 | which provide smarter information in traceback; in particular it will highlight |
|
31 | which provide smarter information in traceback; in particular it will highlight | |
32 | the AST node where an error occurs which can help to quickly narrow down errors. |
|
32 | the AST node where an error occurs which can help to quickly narrow down errors. | |
33 |
|
33 | |||
34 | For example in the following snippet:: |
|
34 | For example in the following snippet:: | |
35 |
|
35 | |||
36 | def foo(i): |
|
36 | def foo(i): | |
37 | x = [[[0]]] |
|
37 | x = [[[0]]] | |
38 | return x[0][i][0] |
|
38 | return x[0][i][0] | |
39 |
|
39 | |||
40 |
|
40 | |||
41 | def bar(): |
|
41 | def bar(): | |
42 | return foo(0) + foo( |
|
42 | return foo(0) + foo( | |
43 | 1 |
|
43 | 1 | |
44 | ) + foo(2) |
|
44 | ) + foo(2) | |
45 |
|
45 | |||
46 |
|
46 | |||
47 | Calling ``bar()`` would raise an ``IndexError`` on the return line of ``foo``, |
|
47 | Calling ``bar()`` would raise an ``IndexError`` on the return line of ``foo``, | |
48 | IPython 8.0 is capable of telling you, where the index error occurs:: |
|
48 | IPython 8.0 is capable of telling you, where the index error occurs:: | |
49 |
|
49 | |||
50 | return x[0][i][0] |
|
50 | return x[0][i][0] | |
51 | ^ |
|
51 | ^ | |
52 |
|
52 | |||
53 | To prepare for Python 3.10 we have also started working on removing reliance and |
|
53 | To prepare for Python 3.10 we have also started working on removing reliance and | |
54 | any dependency that is not Python 3.10 compatible; that include migrating our |
|
54 | any dependency that is not Python 3.10 compatible; that include migrating our | |
55 | test suite to Pytest, and starting to remove nose. |
|
55 | test suite to Pytest, and starting to remove nose. | |
56 |
|
56 | |||
57 | We are also removing support for Python 3.6 allowing internal code to use more |
|
57 | We are also removing support for Python 3.6 allowing internal code to use more | |
58 | efficient ``pathlib``, and make better use of type annotations. |
|
58 | efficient ``pathlib``, and make better use of type annotations. | |
59 |
|
59 | |||
60 | The completer has also seen significant updates and make use of newer Jedi API |
|
60 | The completer has also seen significant updates and make use of newer Jedi API | |
61 | offering faster and more reliable tab completion. |
|
61 | offering faster and more reliable tab completion. | |
62 |
|
62 | |||
63 | For the terminal users this also enable the auto-suggestion feature, described |
|
63 | For the terminal users this also enable the auto-suggestion feature, described | |
64 | below, which show "ghost text" ahead of your cursor you can accept without |
|
64 | below, which show "ghost text" ahead of your cursor you can accept without | |
65 | having to press the tab key or ask the completer to suggest completions. |
|
65 | having to press the tab key or ask the completer to suggest completions. | |
66 |
|
66 | |||
67 |
|
67 | |||
68 | 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>`__. |
|
68 | 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 |
|
69 | |||
70 | `Ptpython <https://github.com/prompt-toolkit/ptpython#ptpython>`__ allows users to enable this feature in |
|
70 | `Ptpython <https://github.com/prompt-toolkit/ptpython#ptpython>`__ allows users to enable this feature in | |
71 | `ptpython/config.py <https://github.com/prompt-toolkit/ptpython/blob/master/examples/ptpython_config/config.py#L90>`__. |
|
71 | `ptpython/config.py <https://github.com/prompt-toolkit/ptpython/blob/master/examples/ptpython_config/config.py#L90>`__. | |
72 |
|
72 | |||
73 | This feature allows users to accept autosuggestions with ctrl e, ctrl f, |
|
73 | This feature allows users to accept autosuggestions with ctrl e, ctrl f, | |
74 | or right arrow as described below. |
|
74 | or right arrow as described below. | |
75 |
|
75 | |||
76 | 1. Start ipython |
|
76 | 1. Start ipython | |
77 |
|
77 | |||
78 | .. image:: ../_images/auto_suggest_prompt_no_text.png |
|
78 | .. image:: ../_images/auto_suggest_prompt_no_text.png | |
79 |
|
79 | |||
80 | 2. Run ``print("hello")`` |
|
80 | 2. Run ``print("hello")`` | |
81 |
|
81 | |||
82 | .. image:: ../_images/auto_suggest_print_hello_suggest.png |
|
82 | .. image:: ../_images/auto_suggest_print_hello_suggest.png | |
83 |
|
83 | |||
84 | 3. Press p to see the autosuggestion |
|
84 | 3. Press p to see the autosuggestion | |
85 |
|
85 | |||
86 | .. image:: ../_images/auto_suggest_print_hello_suggest.png |
|
86 | .. image:: ../_images/auto_suggest_print_hello_suggest.png | |
87 |
|
87 | |||
88 | 4. Press ctrl f, or ctrl e, or right arrow to accept the suggestion |
|
88 | 4. Press ctrl f, or ctrl e, or right arrow to accept the suggestion | |
89 |
|
89 | |||
90 | .. image:: ../_images/auto_suggest_print_hello.png |
|
90 | .. image:: ../_images/auto_suggest_print_hello.png | |
91 |
|
91 | |||
92 | You can also complete word by word: |
|
92 | You can also complete word by word: | |
93 |
|
93 | |||
94 | 1. Run ``def say_hello(): print("hello")`` |
|
94 | 1. Run ``def say_hello(): print("hello")`` | |
95 |
|
95 | |||
96 | .. image:: ../_images/auto_suggest_second_prompt.png |
|
96 | .. image:: ../_images/auto_suggest_second_prompt.png | |
97 |
|
97 | |||
98 | 2. Press d to see the autosuggestion |
|
98 | 2. Press d to see the autosuggestion | |
99 |
|
99 | |||
100 | .. image:: ../_images/audo_suggest_d_phantom.png |
|
100 | .. image:: ../_images/audo_suggest_d_phantom.png | |
101 |
|
101 | |||
102 | 3. Press alt f to accept the first word of the suggestion |
|
102 | 3. Press alt f to accept the first word of the suggestion | |
103 |
|
103 | |||
104 | .. image:: ../_images/auto_suggest_def_phantom.png |
|
104 | .. image:: ../_images/auto_suggest_def_phantom.png | |
105 |
|
105 | |||
106 | Importantly, this feature does not interfere with tab completion: |
|
106 | Importantly, this feature does not interfere with tab completion: | |
107 |
|
107 | |||
108 | 1. After running ``def say_hello(): print("hello")``, press d |
|
108 | 1. After running ``def say_hello(): print("hello")``, press d | |
109 |
|
109 | |||
110 | .. image:: ../_images/audo_suggest_d_phantom.png |
|
110 | .. image:: ../_images/audo_suggest_d_phantom.png | |
111 |
|
111 | |||
112 | 2. Press Tab to start tab completion |
|
112 | 2. Press Tab to start tab completion | |
113 |
|
113 | |||
114 | .. image:: ../_images/auto_suggest_d_completions.png |
|
114 | .. image:: ../_images/auto_suggest_d_completions.png | |
115 |
|
115 | |||
116 | 3A. Press Tab again to select the first option |
|
116 | 3A. Press Tab again to select the first option | |
117 |
|
117 | |||
118 | .. image:: ../_images/auto_suggest_def_completions.png |
|
118 | .. image:: ../_images/auto_suggest_def_completions.png | |
119 |
|
119 | |||
120 | 3B. Press alt f to accept to accept the first word of the suggestion |
|
120 | 3B. Press alt f to accept to accept the first word of the suggestion | |
121 |
|
121 | |||
122 | .. image:: ../_images/auto_suggest_def_phantom.png |
|
122 | .. image:: ../_images/auto_suggest_def_phantom.png | |
123 |
|
123 | |||
124 | 3C. Press ctrl f or ctrl e to accept the entire suggestion |
|
124 | 3C. Press ctrl f or ctrl e to accept the entire suggestion | |
125 |
|
125 | |||
126 | .. image:: ../_images/auto_suggest_match_parens.png |
|
126 | .. image:: ../_images/auto_suggest_match_parens.png | |
127 |
|
127 | |||
128 | To install a version of ipython with autosuggestions enabled, run: |
|
128 | To install a version of ipython with autosuggestions enabled, run: | |
129 |
|
129 | |||
130 | ``pip install git+https://github.com/mskar/ipython@auto_suggest`` |
|
130 | ``pip install git+https://github.com/mskar/ipython@auto_suggest`` | |
131 |
|
131 | |||
132 | Currently, autosuggestions are only shown in the emacs or vi insert editing modes: |
|
132 | Currently, autosuggestions are only shown in the emacs or vi insert editing modes: | |
133 |
|
133 | |||
134 | - The ctrl e, ctrl f, and alt f shortcuts work by default in emacs mode. |
|
134 | - The ctrl e, ctrl f, and alt f shortcuts work by default in emacs mode. | |
135 | - 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/>`__. |
|
135 | - 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 |
|
136 | |||
137 |
|
137 | |||
138 | Show pinfo information in ipdb using "?" and "??" |
|
138 | Show pinfo information in ipdb using "?" and "??" | |
139 | ------------------------------------------------- |
|
139 | ------------------------------------------------- | |
140 |
|
140 | |||
141 | In IPDB, it is now possible to show the information about an object using "?" |
|
141 | In IPDB, it is now possible to show the information about an object using "?" | |
142 | and "??", in much the same way it can be done when using the IPython prompt:: |
|
142 | and "??", in much the same way it can be done when using the IPython prompt:: | |
143 |
|
143 | |||
144 | ipdb> partial? |
|
144 | ipdb> partial? | |
145 | Init signature: partial(self, /, *args, **kwargs) |
|
145 | Init signature: partial(self, /, *args, **kwargs) | |
146 | Docstring: |
|
146 | Docstring: | |
147 | partial(func, *args, **keywords) - new function with partial application |
|
147 | partial(func, *args, **keywords) - new function with partial application | |
148 | of the given arguments and keywords. |
|
148 | of the given arguments and keywords. | |
149 | File: ~/.pyenv/versions/3.8.6/lib/python3.8/functools.py |
|
149 | File: ~/.pyenv/versions/3.8.6/lib/python3.8/functools.py | |
150 | Type: type |
|
150 | Type: type | |
151 | Subclasses: |
|
151 | Subclasses: | |
152 |
|
152 | |||
153 | Previously, "pinfo" or "pinfo2" command had to be used for this purpose. |
|
153 | Previously, "pinfo" or "pinfo2" command had to be used for this purpose. | |
154 |
|
154 | |||
155 |
|
155 | |||
156 | Autoreload 3 feature |
|
156 | Autoreload 3 feature | |
157 | ==================== |
|
157 | ==================== | |
158 |
|
158 | |||
159 | Example: When an IPython session is ran with the 'autoreload' extension loaded, |
|
159 | Example: When an IPython session is ran with the 'autoreload' extension loaded, | |
160 | you will now have the option '3' to select which means the following: |
|
160 | you will now have the option '3' to select which means the following: | |
161 |
|
161 | |||
162 | 1. replicate all functionality from option 2 |
|
162 | 1. replicate all functionality from option 2 | |
163 | 2. autoload all new funcs/classes/enums/globals from the module when they're added |
|
163 | 2. autoload all new funcs/classes/enums/globals from the module when they're added | |
164 | 3. autoload all newly imported funcs/classes/enums/globals from external modules |
|
164 | 3. autoload all newly imported funcs/classes/enums/globals from external modules | |
165 |
|
165 | |||
166 | Try ``%autoreload 3`` in an IPython session after running ``%load_ext autoreload`` |
|
166 | Try ``%autoreload 3`` in an IPython session after running ``%load_ext autoreload`` | |
167 |
|
167 | |||
168 | For more information please see unit test - |
|
168 | For more information please see unit test - | |
169 | extensions/tests/test_autoreload.py : 'test_autoload_newly_added_objects' |
|
169 | extensions/tests/test_autoreload.py : 'test_autoload_newly_added_objects' | |
170 | ======= |
|
|||
171 |
|
170 | |||
|
171 | ======= | |||
172 |
|
172 | |||
173 | .. DO NOT EDIT THIS LINE BEFORE RELEASE. FEATURE INSERTION POINT. |
|
173 | .. DO NOT EDIT THIS LINE BEFORE RELEASE. FEATURE INSERTION POINT. | |
174 |
|
174 | |||
175 | As a reminder, IPython master has diverged from the 7.x branch, thus master may |
|
175 | As a reminder, IPython master has diverged from the 7.x branch, thus master may | |
176 | have more feature and API changes. |
|
176 | have more feature and API changes. | |
177 |
|
177 | |||
178 | Backwards incompatible changes |
|
178 | Backwards incompatible changes | |
179 | ------------------------------ |
|
179 | ------------------------------ | |
180 |
|
180 | |||
181 | .. DO NOT EDIT THIS LINE BEFORE RELEASE. INCOMPAT INSERTION POINT. |
|
181 | .. DO NOT EDIT THIS LINE BEFORE RELEASE. INCOMPAT INSERTION POINT. |
General Comments 0
You need to be logged in to leave comments.
Login now