Skip to content

Conversation

@shayanhoshyari
Copy link
Contributor

@shayanhoshyari shayanhoshyari commented Dec 27, 2025

a94bd0f recently added support for injecting dependencies for easier use of debugger. It allows injecting deps via --@rules_python//python/config_settings:debugger=<target>. While the runfiles from <target> were inherited in the final binary, the imports or venv_site_packages were missing. Hence making the debugger target unusable for various corner cases (e.g. when it uses imports = ... or when it is coming from pip hub and venv_site_packages are on).

This PR fixes that, and extends the unit test to include this situation.

Fixes: #3481

Shayan Hoshyari added 2 commits December 26, 2025 21:02
@shayanhoshyari
Copy link
Contributor Author

cc: @rickeylev

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @shayanhoshyari, 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 resolves a critical bug in rules_python where debugger targets, when specified via --@rules_python//python/config_settings:debugger=<target>, failed to correctly inherit their imports and venv_site_packages dependencies. The fix ensures that these essential components are properly included in the final binary, making the debugger functionality fully operational for scenarios involving custom import paths or virtual environments managed by pip integration. The changes also include extended unit tests to cover these previously failing edge cases.

Highlights

  • Debugger Dependency Propagation: Fixed an issue where imports and venv_site_packages from debugger targets were not correctly propagated, leading to unusable debugger setups in certain scenarios.
  • Centralized Dependency Collection: Introduced a new helper function collect_deps in common.bzl to standardize how dependencies are gathered, including extra_deps.
  • Enhanced Import and CC Info Collection: Updated collect_imports and collect_cc_info in common.bzl to leverage the new collect_deps function and properly incorporate extra_deps.
  • Virtual Environment Integration: Modified py_executable.bzl to ensure extra_deps (specifically debugger dependencies) are correctly passed and processed when creating virtual environments, thus including their site-packages.
  • Expanded Unit Test Coverage: Added new unit tests to py_executable_base_tests.bzl to specifically validate the correct propagation of imports and venv_site_packages for debugger targets.

🧠 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 correctly fixes an issue where imports and venv_site_packages from a debugger dependency were not being propagated to the target executable. The fix involves passing the debugger dependency to the functions that collect imports and venv files. The change also includes a valuable refactoring that extracts a common collect_deps function, improving code clarity and reducing duplication. The accompanying test case is thorough, covering both the imports and venv_site_packages scenarios, and correctly verifies the fix. The changes are well-implemented and I have no further suggestions.

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.

New --debugger flag does not propagate imports=... or venv_site_packages

1 participant