bazel-contrib / bazel-contrib/rules_python

`bazel run` should run in bazel env working directory

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

説明

# 🚀 feature request

### Relevant Rules
This is meant to change the behavior of `py_binary`

### Description
Currently if you run a binary with `bazel run` then the working directory will be the sandboxed bazel directory. This behavior is inconsistent with other implementations, for example in `rules_go` it is set like this https://github.com/bazel-contrib/rules_go/blob/b60f4475e3d97431318da1a0a81752a8884e6994/go/tools/go_bin_runner/main.go#L250

### Describe the solution you'd like

`bazel run` should use the `BUILD_WORKING_DIRECTORY` environment variable to set the working directory.

### Describe alternatives you've considered

You can do this hack where you add `--run_under="cd $PWD &&"` to the command but it only works on POSIX systems and you basically have to know the trick to have the command do what you might expect

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

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

調査の方向性

Start at the py_binary implementation involved in bazel run and compare its behavior with the rules_go runner linked in the issue. Verify how BUILD_WORKING_DIRECTORY is exposed, then confirm that bazel run uses it as the working directory rather than the sandbox directory.

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

評価

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

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

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