Skip to content

Conversation

@rickeylev
Copy link
Collaborator

WIP draft of adding windows support to py_zipapp rules

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @rickeylev, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request is a work-in-progress to extend the py_zipapp rules to fully support Windows. It introduces the necessary logic to create native Windows executables for Python zip applications, adapting the build process to the Windows environment. The changes include platform-specific launcher generation and updates to the build rule attributes and test configurations to enable Windows compatibility.

Highlights

  • Windows Launcher Creation: Introduced a new function, _create_windows_exe_launcher, to generate platform-specific .exe launchers for Python zip applications on Windows, ensuring proper execution and runfiles handling.
  • Conditional Executable Generation: Modified the _py_zipapp_executable_impl function to conditionally produce a Windows .exe output for py_zipapp_binary targets when the build is targeting a Windows platform, alongside the standard zip file.
  • New Rule Attributes for Windows Support: Added several new attributes to the py_zipapp_binary rule, including _launcher, _windows_constraints, and a conditional _windows_launcher_maker, to facilitate the Windows-specific build logic and toolchain integration.
  • Test Configuration Updates: Updated the BUILD.bazel file in the tests/py_zipapp directory by commenting out target_compatible_with = NOT_WINDOWS for various targets, thereby enabling these tests and binaries to be built and run on Windows as part of the ongoing development.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds Windows support to the py_zipapp rules by introducing logic to create a Windows .exe launcher. The implementation in py_zipapp_rule.bzl appears solid, correctly handling platform differences and Bazel version compatibility.

However, there are significant issues with the accompanying tests that need to be addressed:

  1. In tests/py_zipapp/BUILD.bazel, a necessary dependency on absl_py is commented out for one of the test targets. This will cause a runtime failure.
  2. The test implementation files (venv_zipapp_test.py and system_python_zipapp_test.py) have not been updated. They contain assertions that will fail on Windows because they expect a shell script instead of a Windows executable. The tests need to be made platform-aware to properly validate this new functionality.

Fixing these test issues is critical for ensuring the Windows support is robust and verifiable.

target_compatible_with = NOT_WINDOWS,
deps = ["@dev_pip//absl_py"],
##target_compatible_with = NOT_WINDOWS,
##deps = ["@dev_pip//absl_py"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This dependency on @dev_pip//absl_py has been commented out. However, the main source file for this target (main.py) imports absl. Without this dependency, the test will fail at runtime with an ImportError. This dependency should be restored.

Suggested change
##deps = ["@dev_pip//absl_py"],
deps = ["@dev_pip//absl_py"],

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

Successfully merging this pull request may close these issues.

1 participant