py_zipapp duplicates shared libraries
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 68/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- python
- Ambito
- build-system
Direzione di ricerca
Inizia da tools/private/zipapp/zipper.py e dalla riproduzione di py_zipapp_binary nell’issue. Esegui bazel build //:demo_zip, ispeziona l’archivio risultante con unzip -l e confronta i due percorsi cygrpc. Il lavoro è completato quando la shared library viene copiata una sola volta e l’altro percorso viene rappresentato come symlink.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
🐞 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
- Lingua principale
- Starlark
- Stelle
- 690
- Fork
- 722
- Merge medio
- 1g 55m
- PR unite (30g)
- 38
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di bazel-contrib/rules_python
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
bazel-contrib/rules_python#4179 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
bazel-contrib/rules_python#4164 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
bazel-contrib/rules_python#3821 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
bazel-contrib/rules_python#4181 ·
-
Release 2.4.0 Apertatype: release
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
bazel-contrib/rules_python#4175 · 3 commenti ·
Tutte le issue di bazel-contrib/rules_python
Issue simili
-
typst-0.12 Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
commercialhaskell/stackage#8127 ·
-
[CI] Nightly Clang build broken: structured binding captured in a lambda in FileDataSource.cpp Apertabug build
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 91/100
facebookincubator/velox#19194 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
-
agentic-workflows maintenance
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
nebari-dev/jhub-apps#742 ·