Skip to content

Support isolated pip.parse#3669

Open
ouillie wants to merge 3 commits intobazel-contrib:mainfrom
ouillie:isolated
Open

Support isolated pip.parse#3669
ouillie wants to merge 3 commits intobazel-contrib:mainfrom
ouillie:isolated

Conversation

@ouillie
Copy link

@ouillie ouillie commented Mar 17, 2026

closes #3668

Adds a fallback at the end of build_config: when defaults["platforms"] is empty, it detects the host OS and CPU and injects a single platform entry. This fixes the test (and the patch works for my motivating use-case).

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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 enhances the pip.parse extension to properly support isolated usage within Bazel modules. It addresses a scenario where rules_python's default platform tags might not be visible in an isolated context, by programmatically providing a minimal host platform configuration. This change ensures that requirement files can still be parsed and dependencies resolved, improving the robustness and flexibility of Python dependency management in Bazel.

Highlights

  • Isolated pip.parse Support: Enabled pip.parse extensions to function correctly in isolated Bazel module contexts by ensuring a default host platform configuration is provided when no platforms are explicitly configured.
  • New Integration Tests: Introduced a new integration test suite (pip_parse_isolated) to validate the functionality of pip.parse when used with isolate = True.

🧠 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.

Changelog
  • .bazelrc.deleted_packages
    • Added tests/integration/pip_parse_isolated to the list of deleted packages.
  • python/private/pypi/extension.bzl
    • Implemented logic to automatically configure a default host platform if no platforms are specified, specifically for isolated extension contexts.
  • tests/integration/BUILD.bazel
    • Added a new rules_python_integration_test target named pip_parse_isolated_test.
  • tests/integration/pip_parse_isolated/.bazelrc
    • Added a new Bazel configuration file for the isolated test, enabling experimental_isolated_extension_usages.
  • tests/integration/pip_parse_isolated/BUILD.bazel
    • Added a py_test target test_isolated that depends on @pypi//six.
  • tests/integration/pip_parse_isolated/MODULE.bazel
    • Defined a new module pip_parse_isolated that uses pip.parse with isolate = True to fetch six.
  • tests/integration/pip_parse_isolated/requirements_lock.txt
    • Added a lock file specifying six==1.17.0.
  • tests/integration/pip_parse_isolated/test_isolated.py
    • Added a Python unit test to verify that the six package can be imported successfully.
Activity
  • No human activity has occurred on this pull request yet.
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 support for isolated pip.parse calls in bzlmod. The main change introduces logic to create a default host-based platform when no platforms are configured, which is the case in isolated mode. This allows pip.parse to function correctly. The PR also includes a comprehensive integration test to validate the new functionality. The changes are well-implemented and the tests cover the new feature appropriately. I have one minor suggestion to improve code readability.

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.

isolate = True is broken for pip.parse

1 participant