bazel-contrib / bazel-contrib/rules_python
Hermetic toolchains incur a significant overhead to running py_binary and py_test
- 主要言語
- Starlark
- スター
- 688
- フォーク
- 721
- 平均マージ
- 15時間 7分
- マージ済み PR(30日)
- 76
説明
# 🐞 bug report
### Affected Rule
`py_binary` and `py_test`
### Is this a regression?
No
### Description
Hermetic toolchains incur a significant overhead to executing Python targets due to the large amount of files which are added to the runfiles tree.
You find an analysis of the issue here: https://github.com/martis42/show_hermetic_python_overhead
Bazel caching of course negates much of this issue in daily working.
Still, whenever a test has to rerun we pay this additional overhead.
I don't know if there is a "perfect" solution possible given how Bazel sandboxing works.
However, it would be great if rues_python would add a note in its documentation for hermetic toolchains that adding `--nolegacy_external_runfiles` to the `.bazelrc` file is recommended.
Maybe the `rules_python` maintainer can even convince the Bazel maintainer to prioritize working on flipping `--legacy_external_runfiles` in Bazel 8 ?
## 🔬 Minimal Reproduction
You see reproduce this with this small example workspace https://github.com/martis42/show_hermetic_python_overhead
## 🔥 Exception or Error
NA
## 🌍 Your Environment
**Operating System:**
Linux Mint 21.1
**Output of `bazel version`:**
Bazelisk version: v1.16.0
Build label: 7.0.0
Build target: @@//src/main/java/com/google/devtools/build/lib/bazel:BazelServer
Build time: Mon Dec 11 16:51:49 2023 (1702313509)
Build timestamp: 1702313509
Build timestamp as int: 1702313509
**Rules_python version:**
0.27.0
**Anything else relevant?**
https://github.com/bazelbuild/rules_python/issues/1624 might be related.
It is however maybe Windows specific.
コントリビューションガイド
調査の方向性
リンクされている show_hermetic_python_overhead workspace から始め、hermetic toolchain を使った py_binary と py_test の実行を比較します。hermetic-toolchain のドキュメントと .bazelrc の設定 --nolegacy_external_runfiles を読みます。オーバーヘッドと推奨事項が明確に文書化されるか、制限事項が説明されれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- build-system, performance
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100