python / python/cpython

pyrepl autocomplete from x import <tab> to only display public members

オープン
#149,167 コメント 2 件 リアクション 2 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

stdlib topic-repl type-feature
主要言語
Python
スター
77.2k
フォーク
35.9k
PR マージ指標
PR 指標を取得中

説明

Feature or enhancement

Proposal:

When using autocomplete in the REPL, from x import <tab> will show all non-underscore prefixed members. This is a dir-like behavior that is useful to inspect and understand what can be imported.

However, this mechanism isn't filtering on __all__ of the module and can yield a long list of non-useful candidates to autocomplete. Two examples shown below, pathlib and collections.abc.

The feature request is that when a user enters from x import <tab> only the candidates defined in __all__ are listed.

Image Image
Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Linked PRs
  • gh-156146

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

from x import <tab> に対する pyrepl のオートコンプリートのエントリポイントから始め、既存の dir のような候補フィルタリングを調べます。オートコンプリートのテストがあれば確認し、issue の pathlib と collections.abc の例を使って、__all__ に公開されている名前だけが一覧表示されることを検証します。リンクされた PR gh-156146 は、作業がすでに進行中であることを示しています。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
cli
issue の種類
機能追加
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。