-
Notifications
You must be signed in to change notification settings - Fork 555
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
Unable to compile standalone gazelle binary with rules_python plugin #1455
Comments
The gazelle plugin depends on a python interpreter and a few python files that are executed using the said interpreter, so creating a standalone binary would not be possible. The fact that gazelle needs to:
makes it very difficult to achieve without having a Python interpreter. |
Just to add here what has been discussed over Slack, https://github.com/kluctl/go-embed-python seems to be like an interesting way to embed the Python interpreter into a go binary and we could potentially use this project to include our own Python toolchain. |
Possible duplicate of py_binary with hermetic toolchain requires a system interpreter |
The runtime dependencies of Gazelle Python extension makes it hard to distribute Gazelle binaries: we have to preserve the runfiles structure and distribute it with Gazelle binaries. Instead, we can build a single Python zip file that comes a built-in interpreter, and embed the zip file into the Go binary in compile time and avoid the runtime dependency. Fixes #1455 --------- Co-authored-by: Ignas Anikevicius <240938+aignas@users.noreply.github.com>
Thank you! This is perfect for my needs. Agree that #691 needs to be addressed but this will remove the need for a genrule where I basically create a runfiles dir next to my pre-compiled gazelle. Cheers! |
Context:
I work within a repo where we require building a static gazelle binary per platform that is checked into git LFS. The precompiled binaries are then used for pre-commit hooks and can be run in CI environments without the need to build from source with bazel.
Issue:
I'm having issues compiling gazelle with the rules_python package because it makes use of runfiles.
The runfiles however is not portable and short of patching the parser.go I don't see a clear path to compiling this gazelle plugin to be a portable go binary.
Is this intentional or could there be an alternative that allows for this?
The text was updated successfully, but these errors were encountered: