classification
Title: IDLE: Add import statement completion
Type: enhancement Stage: needs patch
Components: IDLE Versions: Python 3.6
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Ramchandra Apte, martin.panter, roger.serwy, serhiy.storchaka, terry.reedy
Priority: normal Keywords:

Created on 2013-02-19 15:32 by Ramchandra Apte, last changed 2016-07-25 02:51 by terry.reedy.

Messages (5)
msg182392 - (view) Author: Ramchandra Apte (Ramchandra Apte) * Date: 2013-02-19 15:32
[patch under development]
I propose to add completions for 
import <tab>
from <tab>
from x import <tab>

Also, if one types imp.<tab> , IDLE should import the module and list dir(module).
(There will be an option to disable/enable the last two completion cases as some users object to it importing modules for completion)
msg191227 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2013-06-15 19:22
Making a list of all possible modules is harder than a list of attributes. With relative imports, I am not sure its even possible to sensible make a list of every entry that would work.
msg191260 - (view) Author: Ramchandra Apte (Ramchandra Apte) * Date: 2013-06-16 05:06
I have a patch ready; have to make it ready (PEP8-compliance etc.) and then
I can send it.

On 16 June 2013 00:52, Terry J. Reedy <report@bugs.python.org> wrote:

>
> Terry J. Reedy added the comment:
>
> Making a list of all possible modules is harder than a list of attributes.
> With relative imports, I am not sure its even possible to sensible make a
> list of every entry that would work.
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue17238>
> _______________________________________
>
msg271199 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-07-25 01:23
Even if your patch isn’t quite ready, it may (have been) better than nothing :)

I had the idea to share stuff between Idle completion and Readline completion, but after looking at the Idle code, it did not seem very practical in general. But maybe you can at least use some ideas, test cases, or share the low level code from Issue 25419. E.g. my patch there has method _import_matches() that takes a path of packages and yields (sub)module names, and method _from_import_matches() that also yields module attribute names.
msg271216 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016-07-25 02:51
I change 'enhance' to 'add' because there is no 'import completion' now.

Ramchandra, when replying by email, delete the quoted email.  But do submit a patch even is less than perfect.

The idea of autoimporting a name to complete an attribute is separate from the idea of doing something special in import statements.  Autoimport is the subject of #18766, which has a patch and my thoughts so far.  So this issue is only about import statements.

Martin, I just opened #27609 as an umbrella issue for multiple completion issues.  I am not happy with the current IDLE completion code.  Does any of the readline completion code depend on function provided by readline, or is it all an extension of readline, using logic in Python?
History
Date User Action Args
2016-07-25 02:51:20terry.reedysettitle: IDLE: Enhance import statement completion -> IDLE: Add import statement completion
messages: + msg271216
versions: + Python 3.6, - Python 3.4
2016-07-25 01:23:33martin.pantersetnosy: + martin.panter
messages: + msg271199
2016-07-25 00:08:07terry.reedylinkissue27609 dependencies
2013-06-17 20:35:11serhiy.storchakasetnosy: + serhiy.storchaka
2013-06-16 05:06:35Ramchandra Aptesetmessages: + msg191260
2013-06-15 19:22:40terry.reedysetmessages: + msg191227
2013-04-07 01:36:20roger.serwysetnosy: + roger.serwy

title: Enhance import statement completion -> IDLE: Enhance import statement completion
2013-02-19 15:35:51ezio.melottisetstage: needs patch
versions: - Python 3.3
2013-02-19 15:32:51Ramchandra Aptecreate