GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-130472: Use fancycompleter in import completions by tomasr8 · Pull Request #148188 · python/cpython

Conversation

@tomasr8

@tomasr8 tomasr8 commented Apr 6, 2026 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member
image

Now that #130473 has been merged, let's use it for import completions as well.
This is my first stab at this. First, I did a bit of refactoring and extracted the getattr and colorize logic from FancyCompleter into reusable functions since I needed those for module completions. I also modified ModuleCompleter to return attribute values in addition to names (for modules, it just returns the sys module as a dummy value, this is just to get the color right). Then I just needed to extend get_module_completions to do the colorization.

@loic-simon would love if you have some spare time to have a look :)

  • Issue: Use colors in tab-completion in PyREPL #130472

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

loic-simon reacted with eyes emoji
All reactions
  • 👀 1 reaction
tomasr8 added 7 commits April 6, 2026 22:30
@tomasr8
Extract safe_getattr into a separate function
89dde8f
@tomasr8
Extract colorize methods into reusable functions
2b05c47
@tomasr8
Colorize import completions
8e75eb6
- Make module completer return both names and values (dummy `sys` module
in case of module completions)
- Colorize completions using `colorize_matches` from FancyCompleter
@tomasr8
Add tests
3b20cf3
@tomasr8
Simplify logic
9e9d9d8
@tomasr8
Improve tests
a1576a0
@tomasr8
Restore original test name
7c95992
@tomasr8
tomasr8 requested review from ambv, lysnikolaou and pablogsal as code owners April 6, 2026 21:08
@bedevere-app bedevere-app Bot added the awaiting core review label Apr 6, 2026
@bedevere-app bedevere-app Bot mentioned this pull request Apr 6, 2026
Use colors in tab-completion in PyREPL #130472
Closed
loic-simon
loic-simon reviewed Apr 6, 2026
View reviewed changes

@loic-simon loic-simon left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!! Here's a quick first pass, I'll play around with it in local later 😄

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/_pyrepl/_module_completer.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/_pyrepl/_module_completer.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/_pyrepl/readline.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/test/test_pyrepl/test_pyrepl.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

tomasr8 and others added 5 commits April 8, 2026 20:48
@tomasr8
Use consistent type annotations
f7dc27b
@tomasr8 @loic-simon
Attributes come first
fe605cf
Co-authored-by: Loïc Simon <[email protected]>
@tomasr8
Make mypy happy
30c576d
@tomasr8
Add a test
94e783c
@tomasr8
Add news entry
04b5d42
@loic-simon

loic-simon commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

Tested in local, all good for me! 🚀

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@loic-simon loic-simon mentioned this pull request Apr 12, 2026
gh-69605: PyREPL: insert "import" after "from foo <tab>" #148445
Merged
@pablogsal
fixup! Add news entry
0b29824
@pablogsal

pablogsal commented May 5, 2026

Copy link
Copy Markdown
Member

LGTM Great work @tomasr8 and thanks for the review @loic-simon. I have pushed a commit with some fixed and simplifications so it can make it to tomorrow's deadline!

loic-simon reacted with rocket emoji
All reactions
  • 🚀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@pablogsal
pablogsal enabled auto-merge (squash) May 5, 2026 01:11
@pablogsal
pablogsal disabled auto-merge May 5, 2026 01:11
@pablogsal
pablogsal enabled auto-merge (squash) May 5, 2026 01:12
@read-the-docs-community

read-the-docs-community Bot commented May 5, 2026

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #32535593 | 📁 Comparing 0b29824 against main (2995d45)

  🔍 Preview build  

147 files changed · ± 145 modified · - 2 deleted

± Modified

  • glossary.html
  • index.html
  • c-api/allocation.html
  • c-api/buffer.html
  • c-api/bytes.html
  • c-api/code.html
  • c-api/concrete.html
  • c-api/descriptor.html
  • c-api/dict.html
  • c-api/exceptions.html
  • and 135 more...

- Deleted

  • c-api/sentinel.html
  • deprecations/soft-deprecations.html
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

pablogsal
pablogsal approved these changes May 5, 2026
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels May 5, 2026
@pablogsal
pablogsal merged commit ed99680 into python:main May 5, 2026
65 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@pablogsal pablogsal pablogsal approved these changes
@lysnikolaou lysnikolaou Awaiting requested review from lysnikolaou lysnikolaou is a code owner
@ambv ambv Awaiting requested review from ambv ambv is a code owner
+1 more reviewer
@loic-simon loic-simon loic-simon left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@tomasr8 @loic-simon @pablogsal
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.