Skip to content

PyREPL: auto-complete module attributes in import statements #140870

Description

@loic-simon

Feature or enhancement

Proposal:

Support for auto-completion of import statements can be separated between


As discussed on Discourse, automatically importing modules when pressing TAB would be too intrusive and unsafe, considering import-time side effects.

A solution that seems acceptable to most people, though, is to prompt the user to press TAB again to import the module and see its contents.

Has this already been discussed elsewhere?

I have already discussed this feature proposal on Discourse

Links to previous discussion of this feature:

https://discuss.python.org/t/looking-for-feedback-on-adding-import-autocomplete-to-pyrepl/82281

Linked PRs

Activity

  1. added 2 commits that reference this issue on Nov 1, 2025
  2. added
    stdlibStandard Library Python modules in the Lib/ directory
    topic-replRelated to the interactive shell
    on Nov 1, 2025
  3. added a commit that references this issue on Dec 28, 2025
  4. added a commit that references this issue on Dec 28, 2025
  5. added a commit that references this issue on Dec 28, 2025
  6. added a commit that references this issue on Feb 15, 2026
  7. loic-simon commented on Apr 5, 2026

    @loic-simon
    ContributorAuthor

    @tomasr8 @ambv Hey, we're now 1 month from the 3.15 feature freeze, do you think #140871 could make it? 🙏
    Please tell me if there's anything more I can do!

  8. added 2 commits that reference this issue on Apr 5, 2026
  9. tomasr8 commented on Apr 5, 2026

    @tomasr8
    Member

    Looks like Pablo beat me to it 😆 I'm really sorry I but I've had very limited time in the last couple of months due to family.. Thanks a lot @loic-simon for getting it across the finish line, it's great to finally have it merged! :)

  10. pablogsal commented on Apr 5, 2026

    @pablogsal
    Member

    Thanks a lot for your contribution @loic-simon 🚀

  11. tomasr8 commented on Apr 5, 2026

    @tomasr8
    Member

    Also, now that #130473 is merged as well, it'd be nice to get the same colored completion for import attributes as well. I'm having a look but at a minimum I think we'll need to:

    • Make module completer return attribute values, not just the names
    • Extract colorize_matches from FancyCompleter and reuse it for imports
  12. loic-simon commented on Apr 5, 2026

    @loic-simon
    ContributorAuthor

    Oh yes, that would be great! Don't hesitate to ping me for any review/help 👌

  13. added a commit that references this issue on Apr 25, 2026
  14. loic-simon commented on Jun 2, 2026

    @loic-simon
    ContributorAuthor

    Hey, should this change be included in the What's New?
    Since there is already a "default interactive shell" section with fancycompleter changes, I guess it would make sense?

  15. loic-simon commented on Jul 18, 2026

    @loic-simon
    ContributorAuthor

    Gentle ping @pablogsal (as you merged this) and @hugovk (as What's New editor), happy to draft a PR if needed, I'm not sure what the process is :)

  16. added a commit that references this issue on Sep 1, 2026
  17. added a commit that references this issue on Sep 4, 2026
  18. added a commit that references this issue on Sep 5, 2026
  19. added a commit that references this issue on Sep 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytopic-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