Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

PyREPL: autocomplete built-in modules #134235

Closed
Labels
easystdlibPython modules in the Lib dirtopic-replRelated to the interactive shelltype-featureA feature request or enhancement
@tomasr8

Description

@tomasr8

Feature or enhancement

Proposal:

Currently, built-in modules (i.e.sys) are not autocompleted in the new REPL. For instance, typingimport sy<tab> does not offersys as a completion possibility.

This is because we usepkgutil.iter_modules under the hood. Since built-in modules have no underlying.py file, they don't show up.

It would be great if the autocomplete could still work with these modules. One possibility would be looking atsys.builtin_module_names and combining it with the results ofpkgutil.iter_modules.

The relevant code is in this class:

classModuleCompleter:
"""A completer for Python import statements.

Here's how I think we can implement it:

  • Find built-in modules by looking atsys.builtin_module_names
  • Merge the results withModuleCompleter.global_cache (might need changing how we represent the modules)

IIUC we only have built-in top-level modules, not submodules, so that should simplify the implementation.

Please don't pick up this issue, I'd like to reserve it for someone at the PyConUS sprints :)

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    easystdlibPython modules in the Lib dirtopic-replRelated to the interactive shelltype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp