Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce dependencies for generated wrapper script. #673

Closed
adam-azarchs opened this issue Mar 26, 2022 · 1 comment
Closed

Reduce dependencies for generated wrapper script. #673

adam-azarchs opened this issue Mar 26, 2022 · 1 comment

Comments

@adam-azarchs
Copy link

🚀 feature request

Relevant Rules

py_binary, py_test

Description

For situations like remote execution or executing in a docker container for hermiticity and reproducibility, it's helpful to keep the container image size to an absolute minimum. The bazel-generated wrapper script, which at least at the moment runs with the system-provided python3, imports a bunch of modules which are not present in the python3-minimal package in the debian ecosystem.

Describe the solution you'd like

The imports

import shutil
import tempfile
import zipfile

are only required if IsRunningFromZip is True. They shouldn't be imported if it isn't.

They're imported by the template here.

The offending imports could be guarded by

if %is_zipfile%:

in the template.

Describe alternatives you've considered

#42 would also solve this problem, mostly. If you have a lot of unit tests to run then the time it takes to process those often-unnecessary imports can add up.

@hrfuller
Copy link
Contributor

hrfuller commented May 8, 2022

The python binary shim template is part of bazelbuild/bazel. Not this repository. I recommend you open an issue in the repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants