bazel-contrib / bazel-contrib/rules_python

Would a py_interactive rule be useful to include?

オープン
#3,090 コメント 9 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Starlark
スター
688
フォーク
721
平均マージ
15時間 7分
マージ済み PR(30日)
76

説明

# 🚀 feature request

This is a request to get thoughts on contributing https://github.com/jpwoodbu/rules_python_interactive to `rules_python`.

### Relevant Rules

Perhaps `py_binary` and `py_library`?

### Description

I have made https://github.com/jpwoodbu/rules_python_interactive, which adds a `py_interactive` macro, and I wonder if it's worth including within `rules_python` itself. I see there's a relatively new [REPL](https://github.com/bazel-contrib/rules_python/blob/main/docs/repl.md) feature that does nearly the same thing. But there are some important ergonomic differences.

1) `py_interactive` targets are set up within `BUILD.bazel` files just like a `py_binary`.
1) `py_interactive` shells have tab completion.
1) `py_interactive` has an optional `pushes` argument for initial setup (e.g. importing a module).

Having the setup within the `BUILD.bazel` file is really the key difference. If you often need to debug inside an interactive shell, it's nice to have the configuration in place and just a simple `bazel run :my_library_interactive` away. The setup is also very easy to understand. In most cases, it's identical to setting up a `py_binary`.

### Describe the solution you'd like

My preferred solution would be to add `py_interactive` from https://github.com/jpwoodbu/rules_python_interactive to `rules_python`, should it makes sense to do so. This is not a proposal to remove the REPL feature. It could be worth having both: one that requires setup but is easier to use and one that only requires the right command line.

### Describe alternatives you've considered

I had considered having a virtual rule for `py_library` where you could run a `py_library` target, perhaps with a `.i` suffix to get an interactive shell. But I suspect there would be many efficiency downsides for Bazel itself. And it lacks the configurability of a whole new rule/macro (e.g. adding a specific collection of `deps` unlike any existing `py_library` targets).

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

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

調査の方向性

docs/repl.mdを読み、参照されているrules_python_interactiveプロジェクトおよび既存のpy_binaryとpy_libraryのエントリポイントと比較してください。完了の条件は、py_interactiveをrules_pythonに含めるかどうか、またREPLとどのように共存させるかについて、メンテナーの判断に至ることです。このissueでは実装やテストの目標は定義しません。

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

評価

技術スタック
python
領域
build-system
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

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

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