Looking for feedback on adding import autocomplete to PyREPL

Keep in mind that this currently lives in a private module inside pyrepl (which is itself private) so the implementation is subject to breaking changes without notice.

However, if you really want to use it, this should do what you want:

>>> from _pyrepl._module_completer import ModuleCompleter
>>> c = ModuleCompleter()
>>> c.get_completions('import pa')
['pathlib']
1 Like

@tomasr8

>>> from sys import e <TAB> <TAB>
elif        else        enumerate(  eval(       except      exec(       exit(

Can we remove keywords and builtins from the autocomplete set?

A

4 Likes

Awesome, thank you! If this ever becomes public somewhere then I’d definitely be a user.

1 Like

This should be the case already. It was added/fixed in gh-69605: Disable PyREPL module autocomplete fallback on regular completion by loic-simon · Pull Request #134181 · python/cpython · GitHub :slight_smile:

1 Like