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 imports processed by python stubs. #15572

Conversation

adam-azarchs
Copy link
Contributor

There are several import statements in the python wrapper stub used by
py_binary and py_test rules which are only used when running from a
zip archive. Processing these imports is a waste of time in the common
case where they aren't going to be used. They also might not be
present at all in some stripped-down python environments (e.g. the
Debian python3-minimal package), which might be the only python
available on a remote builder when using a hermetic python toolchain
(even when using a hermetic python toolchain, the wrapper is executed
using the system python environment).

Closes #15571

There are several import statements in the python wrapper stub used by
`py_binary` and `py_test` rules which are only used when running from a
zip archive.  Processing these imports is a waste of time in the common
case where they aren't going to  be used.  They also might not be
present at all in some stripped-down python environments (e.g. the
Debian `python3-minimal` package), which might be the only python
available on a remote builder when using a hermetic python toolchain
(even when using a hermetic python toolchain, the wrapper is executed
using the system python environment).
@sgowroji sgowroji added team-Rules-Python Native rules for Python awaiting-review PR is awaiting review from an assigned reviewer labels May 25, 2022
@comius comius self-requested a review May 27, 2022 06:00
@comius comius self-assigned this May 27, 2022
@comius
Copy link
Contributor

comius commented May 27, 2022

cc @brandjon do you see any problems with this?

@comius comius requested a review from brandjon May 27, 2022 06:01
@adam-azarchs adam-azarchs deleted the azarchs/reduce-python-wrapper-imports branch July 21, 2022 16:02
@ShreeM01 ShreeM01 removed the awaiting-review PR is awaiting review from an assigned reviewer label Sep 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-Rules-Python Native rules for Python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reduce dependencies for generated python wrapper in common cases.
4 participants