py_zipapp duplicates shared libraries
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 68/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- python
- 領域
- build-system
調査の方向性
tools/private/zipapp/zipper.py と issue 内の py_zipapp_binary reproduction から始めます。bazel build //:demo_zip を実行し、生成されたアーカイブを unzip -l で調べ、2 つの cygrpc パスを比較します。shared library が 1 回だけコピーされ、もう一方のパスが symlink として表現されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
🐞 bug report
Affected Rule
The issue is caused by the rule: py_zipapp_binary
With the following settings
common --@rules_python//python/config_settings:bootstrap_impl=script
common --@rules_python//python/config_settings:venvs_site_packages=yes
common --@rules_python//python/config_settings:venvs_use_declare_symlink=yes
Is this a regression?
No
Description
Shared libraries that shipped in pip packages are duplicated in the zipapp, once in the venv path and once in the wheel run files path. For native heavy packages, such as torch, this can significantly increase the size of the resulting zip file.
This is related to the closed #3439, but there the issue was packaging the run files using third-party rules.
The run file layout has both paths as symlinks pointing to the real file, but when building the zip file one is created as a symlink and the other as a root_symlink. These are added separately into the zip manifest and don't get deduped tools/private/zipapp/zipper.py and instead get byte-copied into the zip file.
I would expect these to be deduped, so that only one copied into the zip file and the other becomes a symlink to that.
🔬 Minimal Reproduction
# BUILD.bazel
load("@rules_python//python:py_binary.bzl", "py_binary")
load("@rules_python//python:py_zipapp_binary.bzl", "py_zipapp_binary")
py_binary(
name = "demo",
srcs = ["demo.py"],
deps = ["@pypi//grpcio"],
)
py_zipapp_binary(name = "demo_zip", binary = ":demo")
$ bazel build //:demo_zip
$ unzip -l bazel-bin/demo_zip.pyz | grep cygrpc
2419632 1980-01-01 00:00 runfiles/rules_python++pip+pypi_311_grpcio_.../site-packages/grpc/_cython/cygrpc.cpython-311-x86_64-linux-gnu.so
2419632 1980-01-01 00:00 runfiles/_main/<pkg>/_demo.venv/lib/python3.11/site-packages/grpc/_cython/cygrpc.cpython-311-x86_64-linux-gnu.so
🔥 Exception or Error
No exceptions or errors
- 主要言語
- Starlark
- スター
- 690
- フォーク
- 722
- 平均マージ
- 1日 55分
- マージ済み PR(30日)
- 38
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
bazel-contrib/rules_python のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
bazel-contrib/rules_python#4179 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
bazel-contrib/rules_python#4164 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
bazel-contrib/rules_python#3821 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
bazel-contrib/rules_python#4181 ·
-
Release 2.4.0 オープンtype: release
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
bazel-contrib/rules_python#4175 · コメント 3 件 ·
bazel-contrib/rules_python の issue をすべて見る
似ている issue
-
typst-0.12 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
commercialhaskell/stackage#8127 ·
-
bug build
難易度 1/5 1時間未満 初心者へのやさしさ 91/100
facebookincubator/velox#19194 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
-
agentic-workflows maintenance
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
nebari-dev/jhub-apps#742 ·