Skip to content

Conversation

@shayanhoshyari
Copy link

@shayanhoshyari shayanhoshyari commented Dec 6, 2025

Experiment for #3439

@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 refactors the handling of runfiles within Python virtual environments by removing the lib_runfiles attribute and consolidating the symlink creation process. The change aims to simplify the internal logic for how Python executables and their virtual environments manage their dependencies, likely addressing an issue or improving efficiency related to runfile resolution.

Highlights

  • Simplified Venv Runfiles Handling: The mechanism for managing runfiles within Python virtual environments has been streamlined, consolidating how dependencies are linked.
  • Removal of lib_runfiles: The lib_runfiles attribute and its associated merging logic have been removed from the _create_executable and _create_venv functions, simplifying the venv structure.
  • Consolidated Symlink Creation: The create_venv_app_files function now directly creates symlinks for all venv-related files and adds them to venv_files, eliminating the separate runfiles_symlinks collection.
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 refactors the venv creation logic to simplify how symlinks are created. It removes the usage of runfiles.symlinks and unifies the handling of files and directories by using ctx.actions.declare_symlink for all cases. This is a good simplification. However, I've found a critical issue in the new implementation where the target path for file symlinks is not correctly calculated relative to the runfiles root, which will likely cause broken symlinks. I've provided a suggestion to fix this.

@shayanhoshyari shayanhoshyari changed the title Test a change for #3439 [not for merge] Test a change for #3439 Dec 6, 2025
Copy link
Collaborator

@rickeylev rickeylev left a comment

Choose a reason for hiding this comment

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

Per discussion in 3439, we have to keep the runfiles.symlinks logic for performance reasons.

venv_files.append(venv_link)
# Just for demonstration purposes,
# there is definitely a better thing to do upstream that removeprefix("../")
link_to_path = link_to.short_path.removeprefix("../") if is_file(link_to) else link_to
Copy link
Collaborator

Choose a reason for hiding this comment

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

If you want to carry a patch, then I suggest calling runfiles_root_path, something like this:

link_to = runfiles_root_path(ctx, link_to.short_path) if is_file(link_to) else link_to

The case not being handled is if the File being mapped into the venv is coming from the main repository. In that case, short_path is foo/bar.txt, but the runfiles root path is e.g. _main/foo/bar.txt. Most things that go into the venv come from external repos, so you rarely see entries without ../ in their short path.

@shayanhoshyari
Copy link
Author

shayanhoshyari commented Dec 9, 2025

Per discussion in #3439, we have to keep the runfiles.symlinks logic for performance reasons.

+1

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.

2 participants