8000 PyREPL: Do not show underscored modules by default during autocompletion · Issue #134215 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

PyREPL: Do not show underscored modules by default during autocompletion #134215

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
tomasr8 opened this issue May 19, 2025 · 1 comment
Open
Assignees
Labels
easy topic-repl Related to the interactive shell type-feature A feature request or enhancement

Comments

@tomasr8
Copy link
Member
tomasr8 commented May 19, 2025

Feature or enhancement

Proposal:

Attribute autocomplete in the new REPL does not show underscored names unless specifically asked for:

>>> class Foo:
...     _foo = 2
...     foo = 3
...     
>>> Foo.<tab>
Foo.foo    Foo.mro()

Note that only Foo.foo is offered. To also get Foo._foo, we need to write Foo._<tab>. We should do the same for the import autocomplete.
Currently it just shows all modules/submodules, including those starting with an underscore:

>>> from importlib import <tab>
_abc                 _bootstrap_external  machinery            readers              simple                                                         
_bootstrap           abc                  metadata             resources            util

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

@tomasr8 tomasr8 added type-feature A feature request or enhancement easy topic-repl Related to the interactive shell labels May 19, 2025
@kevteg
Copy link
kevteg commented May 19, 2025

I'm taking a look! (I'm at pycon us sprints)

kevteg added a commit to kevteg/cpython that referenced this issue May 19, 2025
* Add _should_add_module_name method to the ModuleCompleter module
* Add new tests to check autocomplete behaviour on private method
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
easy topic-repl Related to the interactive shell type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants
0