You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "shaheeramjad (via GitHub)" <gi...@apache.org> on 2026/02/06 11:19:15 UTC

[PR] Fix IndexError in `apache_beam.utils.processes` when pip subprocess fails with short command [beam]

shaheeramjad opened a new pull request, #37536:
URL: https://github.com/apache/beam/pull/37536

   ### Problem
   
   When a pip subprocess fails and the command is passed as a short list (e.g. `['python', '-m', 'pip', 'install', 'pkg']`), the exception handler in `sdks/python/apache_beam/utils/processes.py` raised **IndexError** instead of the intended RuntimeError with traceback and pip output.
   
   The pip-specific branch used a hardcoded index 6 for the "package name" when formatting the error message (`.format(..., args[0][6], ...)`). For `pip install <pkg>` the command list has only 5 elements (indices 0–4), so `args[0][6]` caused **IndexError** and users saw a crash instead of a clear error message.
   
   ### Solution
   
   - **Added `_pip_package_from_args(args)`**  
     Returns a safe string for the "package" field: uses `args[0][6]` only when `args` is a tuple, `args[0]` is a list/tuple, and `len(args[0]) > 6`; otherwise returns `"see output below"`.
   
   - **Guarded the pip branch**  
     Replaced `(args[0][2] == "pip")` with `len(args[0]) > 2 and args[0][2] == "pip"` so we never index `args[0][2]` on a short list.
   
   - **Updated `call`, `check_call`, and `check_output`**  
     All three now use `_pip_package_from_args(args)` instead of `args[0][6]` when building the pip error message.
   
   ### Files changed
   
   - **`sdks/python/apache_beam/utils/processes.py`**
     - New helper `_pip_package_from_args(args)` (with docstring).
     - Pip branch in `call`, `check_call`, and `check_output`: length check + use of helper for package string.
   
   - **`sdks/python/apache_beam/utils/processes_test.py`**
     - `TestErrorHandlingCheckCall.test_check_call_pip_short_command_no_index_error`
     - `TestErrorHandlingCheckOutput.test_check_output_pip_short_command_no_index_error`
     - `TestErrorHandlingCall.test_call_pip_short_command_no_index_error`  
     Each test uses a short pip command (`['python', '-m', 'pip', 'install', 'nonexistent-package-xyz']`), triggers `CalledProcessError`, and asserts that a **RuntimeError** is raised (not IndexError) and that the message contains the subprocess output and `"see output below"`.
   
   ### Testing
   
   - All **12** tests in `apache_beam.utils.processes_test` pass, including the 3 new tests and the existing ones (e.g. long pip command with package at index 6).
   - Run: `python -m unittest apache_beam.utils.processes_test -v`
   
   ### Backward compatibility
   
   - Behavior is unchanged for commands with 7+ elements (e.g. existing `pip download --dest /var <pkg> ...` still shows the package name at index 6).
   - Only the previously broken case (short command) is fixed; no API or contract changes.
   
   ## Related
   
   - Fixes: `Fixes #37515`
   - Component: Python SDK
   
   ------------------------
   
   Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
   
    - [x] Mention the appropriate issue in your description (for example: `addresses #123`), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment `fixes #<ISSUE NUMBER>` instead.
    - [x] Update `CHANGES.md` with noteworthy changes.
    - [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   See the [Contributor Guide](https://beam.apache.org/contribute) for more tips on [how to make review process smoother](https://github.com/apache/beam/blob/master/CONTRIBUTING.md#make-the-reviewers-job-easier).
   
   To check the build health, please visit [https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md](https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md)
   
   GitHub Actions Tests Status (on master branch)
   ------------------------------------------------------------------------------------------------
   [![Build python source distribution and wheels](https://github.com/apache/beam/actions/workflows/build_wheels.yml/badge.svg?event=schedule&&?branch=master)](https://github.com/apache/beam/actions?query=workflow%3A%22Build+python+source+distribution+and+wheels%22+branch%3Amaster+event%3Aschedule)
   [![Python tests](https://github.com/apache/beam/actions/workflows/python_tests.yml/badge.svg?event=schedule&&?branch=master)](https://github.com/apache/beam/actions?query=workflow%3A%22Python+Tests%22+branch%3Amaster+event%3Aschedule)
   [![Java tests](https://github.com/apache/beam/actions/workflows/java_tests.yml/badge.svg?event=schedule&&?branch=master)](https://github.com/apache/beam/actions?query=workflow%3A%22Java+Tests%22+branch%3Amaster+event%3Aschedule)
   [![Go tests](https://github.com/apache/beam/actions/workflows/go_tests.yml/badge.svg?event=schedule&&?branch=master)](https://github.com/apache/beam/actions?query=workflow%3A%22Go+tests%22+branch%3Amaster+event%3Aschedule)
   
   See [CI.md](https://github.com/apache/beam/blob/master/CI.md) for more information about GitHub Actions CI or the [workflows README](https://github.com/apache/beam/blob/master/.github/workflows/README.md) to see a list of phrases to trigger workflows.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix IndexError in `apache_beam.utils.processes` when pip subprocess fails with short command [beam]

Posted by "shaheeramjad (via GitHub)" <gi...@apache.org>.
shaheeramjad commented on PR #37536:
URL: https://github.com/apache/beam/pull/37536#issuecomment-3860479382

   Hi @ damccorm Can you review it
   Regards !!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix IndexError in `apache_beam.utils.processes` when pip subprocess fails with short command [beam]

Posted by "shunping (via GitHub)" <gi...@apache.org>.
shunping commented on code in PR #37536:
URL: https://github.com/apache/beam/pull/37536#discussion_r2824298168


##########
sdks/python/apache_beam/utils/processes.py:
##########
@@ -52,11 +65,12 @@ def call(*args, **kwargs):
     except OSError as e:
       raise RuntimeError("Executable {} not found".format(args[0])) from e
     except subprocess.CalledProcessError as error:
-      if isinstance(args, tuple) and (args[0][2] == "pip"):

Review Comment:
   As mentioned in the other comments, I think we can remove this entire "if" block (and two similar ones below) so we can get rid of the index error and also avoid parsing the package name from the argument list.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix IndexError in `apache_beam.utils.processes` when pip subprocess fails with short command [beam]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #37536:
URL: https://github.com/apache/beam/pull/37536#issuecomment-3990674873

   Reminder, please take a look at this pr: @shunping 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix IndexError in `apache_beam.utils.processes` when pip subprocess fails with short command [beam]

Posted by "damccorm (via GitHub)" <gi...@apache.org>.
damccorm commented on PR #37536:
URL: https://github.com/apache/beam/pull/37536#issuecomment-3872148767

   Hey @shaheeramjad I'll defer to Shunping as the assigned reviewer - in general, all PRs should get auto-assigned reviewers


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix IndexError in `apache_beam.utils.processes` when pip subprocess fails with short command [beam]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #37536:
URL: https://github.com/apache/beam/pull/37536#issuecomment-4206255658

   Reminder, please take a look at this pr: @tvalentyn 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix IndexError in `apache_beam.utils.processes` when pip subprocess fails with short command [beam]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #37536:
URL: https://github.com/apache/beam/pull/37536#issuecomment-4236427452

   Assigning new set of reviewers because Pr has gone too long without review. If you would like to opt out of this review, comment `assign to next reviewer`:
   
   R: @shunping for label python.
   
   Available commands:
   - `stop reviewer notifications` - opt out of the automated review tooling
   - `remind me after tests pass` - tag the comment author after tests pass
   - `waiting on author` - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix IndexError in `apache_beam.utils.processes` when pip subprocess fails with short command [beam]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #37536:
URL: https://github.com/apache/beam/pull/37536#issuecomment-3860484337

   Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment `assign set of reviewers`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix IndexError in `apache_beam.utils.processes` when pip subprocess fails with short command [beam]

Posted by "tvalentyn (via GitHub)" <gi...@apache.org>.
tvalentyn commented on code in PR #37536:
URL: https://github.com/apache/beam/pull/37536#discussion_r2824218187


##########
sdks/python/apache_beam/utils/processes.py:
##########
@@ -44,6 +44,19 @@
 
 else:
 
+  def _pip_package_from_args(args):

Review Comment:
   This is brittle, i'd argue we should print the entire pip command that failed, and its output without attempting to fish out which exact package installation failed. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix IndexError in `apache_beam.utils.processes` when pip subprocess fails with short command [beam]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #37536:
URL: https://github.com/apache/beam/pull/37536#issuecomment-4004702766

   Assigning new set of reviewers because Pr has gone too long without review. If you would like to opt out of this review, comment `assign to next reviewer`:
   
   R: @damccorm for label python.
   
   Available commands:
   - `stop reviewer notifications` - opt out of the automated review tooling
   - `remind me after tests pass` - tag the comment author after tests pass
   - `waiting on author` - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix IndexError in `apache_beam.utils.processes` when pip subprocess fails with short command [beam]

Posted by "shaheeramjad (via GitHub)" <gi...@apache.org>.
shaheeramjad commented on PR #37536:
URL: https://github.com/apache/beam/pull/37536#issuecomment-3863712509

   assign set of reviewers


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix IndexError in `apache_beam.utils.processes` when pip subprocess fails with short command [beam]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #37536:
URL: https://github.com/apache/beam/pull/37536#issuecomment-3863713896

   Assigning reviewers:
   
   R: @shunping for label python.
   
   
   Note: If you would like to opt out of this review, comment `assign to next reviewer`.
   
   Available commands:
   - `stop reviewer notifications` - opt out of the automated review tooling
   - `remind me after tests pass` - tag the comment author after tests pass
   - `waiting on author` - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)
   
   The PR bot will only process comments in the main thread (not review comments).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix IndexError in `apache_beam.utils.processes` when pip subprocess fails with short command [beam]

Posted by "shaheeramjad (via GitHub)" <gi...@apache.org>.
shaheeramjad commented on PR #37536:
URL: https://github.com/apache/beam/pull/37536#issuecomment-3928067588

   @shunping Can You Review Now ?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix IndexError in `apache_beam.utils.processes` when pip subprocess fails with short command [beam]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #37536:
URL: https://github.com/apache/beam/pull/37536#issuecomment-3938410952

   ## [Codecov](https://app.codecov.io/gh/apache/beam/pull/37536?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 57.01%. Comparing base ([`d6920de`](https://app.codecov.io/gh/apache/beam/commit/d6920de30fe8798190ee27d3a6b95d932f72b679?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`fce90a9`](https://app.codecov.io/gh/apache/beam/commit/fce90a959b32d9a0e4f9ecb2b9eb2b57bc6f5f06?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 89 commits behind head on master.
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@              Coverage Diff              @@
   ##             master   #37536       +/-   ##
   =============================================
   + Coverage     40.06%   57.01%   +16.95%     
     Complexity     3404     3404               
   =============================================
     Files          1177     1178        +1     
     Lines        187083   187495      +412     
     Branches       3581     3581               
   =============================================
   + Hits          74947   106908    +31961     
   + Misses       108744    77195    -31549     
     Partials       3392     3392               
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/beam/pull/37536/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [python](https://app.codecov.io/gh/apache/beam/pull/37536/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `80.43% <100.00%> (+40.74%)` | :arrow_up: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/beam/pull/37536?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix IndexError in `apache_beam.utils.processes` when pip subprocess fails with short command [beam]

Posted by "shaheeramjad (via GitHub)" <gi...@apache.org>.
shaheeramjad commented on PR #37536:
URL: https://github.com/apache/beam/pull/37536#issuecomment-3938579464

   > > @shunping Can You Review Now ?
   > 
   > Please fix the tests mentioned in [#37536 (comment)](https://github.com/apache/beam/pull/37536#issuecomment-3928011866)
   
   @shunping Can you check now ?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix IndexError in `apache_beam.utils.processes` when pip subprocess fails with short command [beam]

Posted by "shunping (via GitHub)" <gi...@apache.org>.
shunping commented on PR #37536:
URL: https://github.com/apache/beam/pull/37536#issuecomment-3928083678

   > @shunping Can You Review Now ?
   
   Please fix the tests mentioned in https://github.com/apache/beam/pull/37536#issuecomment-3928011866


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix IndexError in `apache_beam.utils.processes` when pip subprocess fails with short command [beam]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #37536:
URL: https://github.com/apache/beam/pull/37536#issuecomment-4074613726

   Assigning new set of reviewers because Pr has gone too long without review. If you would like to opt out of this review, comment `assign to next reviewer`:
   
   R: @shunping for label python.
   
   Available commands:
   - `stop reviewer notifications` - opt out of the automated review tooling
   - `remind me after tests pass` - tag the comment author after tests pass
   - `waiting on author` - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix IndexError in `apache_beam.utils.processes` when pip subprocess fails with short command [beam]

Posted by "gemini-code-assist[bot] (via GitHub)" <gi...@apache.org>.
gemini-code-assist[bot] commented on PR #37536:
URL: https://github.com/apache/beam/pull/37536#issuecomment-3859845863

   ## Summary of Changes
   
   Hello @shaheeramjad, I'm Gemini Code Assist[^1]! 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 significantly improves the error handling within Apache Beam's Python SDK by addressing a critical `IndexError` that could occur during `pip` subprocess failures. The changes ensure that users receive a meaningful `RuntimeError` with relevant output, rather than an application crash, when `pip` commands with short argument lists fail. This enhances the stability and diagnostic capabilities of the system without altering existing API contracts.
   
   ### Highlights
   
   * **Bug Fix: IndexError in Pip Subprocess Error Handling**: Resolved an IndexError that occurred in `apache_beam.utils.processes` when a pip subprocess failed with a short command list (e.g., `['python', '-m', 'pip', 'install', 'pkg']`). Previously, this would crash the application instead of raising a `RuntimeError` with a descriptive message.
   * **New Helper Function: `_pip_package_from_args`**: Introduced a new internal helper function, `_pip_package_from_args`, to safely extract the package name from the command arguments. This function now returns 'see output below' if the command list is too short to prevent `IndexError`.
   * **Enhanced Robustness in Pip Command Checks**: Added explicit length checks (`len(args[0]) > 2`) before attempting to access `args[0][2]` to determine if the command is a 'pip' command, further preventing `IndexError` with malformed or short command lists.
   * **Updated Subprocess Call Functions**: Modified `call`, `check_call`, and `check_output` functions to utilize the new `_pip_package_from_args` helper when constructing error messages for failed pip subprocesses.
   * **New Test Cases**: Added three new test cases (`test_check_call_pip_short_command_no_index_error`, `test_check_output_pip_short_command_no_index_error`, `test_call_pip_short_command_no_index_error`) to `apache_beam.utils.processes_test.py` to specifically validate the fix for short pip commands.
   
   🧠 **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](https://codeassist.google/code-review/login) to enable Memory in your admin console.**
   
   <details>
   <summary><b>Changelog</b></summary>
   
   * **CHANGES.md**
       * Added an entry documenting the fix for `IndexError` in `apache_beam.utils.processes` when pip subprocess fails with short command.
   * **sdks/python/apache_beam/utils/processes.py**
       * Introduced `_pip_package_from_args(args)` to safely extract package names for pip error messages.
       * Modified `call`, `check_call`, and `check_output` to include length checks for `args[0]` and use `_pip_package_from_args` when formatting pip-related `RuntimeError` messages.
   * **sdks/python/apache_beam/utils/processes_test.py**
       * Added `test_check_call_pip_short_command_no_index_error` to verify `check_call` handles short pip commands without `IndexError`.
       * Added `test_check_output_pip_short_command_no_index_error` to verify `check_output` handles short pip commands without `IndexError`.
       * Added `test_call_pip_short_command_no_index_error` to verify `call` handles short pip commands without `IndexError`.
   </details>
   
   
   
   <details>
   <summary><b>Activity</b></summary>
   
   * The pull request was authored by `shaheeramjad`.
   * The changes address and fix issue `#37515`.
   * The `CHANGES.md` file has been updated to reflect this bugfix.
   * New tests have been added to cover the specific scenario of short pip commands, and all 12 existing tests in `apache_beam.utils.processes_test` continue to pass.
   * The changes maintain backward compatibility, only fixing previously broken behavior without altering existing functionality for longer commands.
   </details>
   
   
   <details>
   <summary><b>Using Gemini Code Assist</b></summary>
   <br>
   
   The full guide for Gemini Code Assist can be found on our [documentation page](https://developers.google.com/gemini-code-assist/docs/review-github-code), here are some quick tips.
   
   <b>Invoking Gemini</b>
   
   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.
   
   <b>Customization</b>
   
   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](https://developers.google.com/gemini-code-assist/docs/customize-gemini-behavior-github).
   
   <b>Limitations & Feedback</b>
   
   Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with :thumbsup: and :thumbsdown: 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](https://google.qualtrics.com/jfe/form/SV_2cyuGuTWsEw84yG).
   
   <b>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](https://cloud.google.com/products/gemini/code-assist).</b>
   </details>
   
   
   
   
   [^1]: Review the [Privacy Notices](https://policies.google.com/privacy), [Generative AI Prohibited Use Policy](https://policies.google.com/terms/generative-ai/use-policy), [Terms of Service](https://policies.google.com/terms), and learn how to configure Gemini Code Assist in GitHub [here](https://developers.google.com/gemini-code-assist/docs/customize-gemini-behavior-github). Gemini can make mistakes, so double check it and [use code with caution](https://support.google.com/legal/answer/13505487).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix IndexError in `apache_beam.utils.processes` when pip subprocess fails with short command [beam]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #37536: Fix IndexError in `apache_beam.utils.processes` when pip subprocess fails with short command
URL: https://github.com/apache/beam/pull/37536


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix IndexError in `apache_beam.utils.processes` when pip subprocess fails with short command [beam]

Posted by "damccorm (via GitHub)" <gi...@apache.org>.
damccorm commented on PR #37536:
URL: https://github.com/apache/beam/pull/37536#issuecomment-4306424267

   waiting on author


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix IndexError in `apache_beam.utils.processes` when pip subprocess fails with short command [beam]

Posted by "tvalentyn (via GitHub)" <gi...@apache.org>.
tvalentyn commented on code in PR #37536:
URL: https://github.com/apache/beam/pull/37536#discussion_r3017846482


##########
CHANGES.md:
##########
@@ -83,6 +83,7 @@
 
 ## Bugfixes
 
+* Fixed IndexError in `apache_beam.utils.processes` when pip subprocess fails with short command (e.g. `pip install pkg`) (Python) ([#37515](https://github.com/apache/beam/issues/37515)).

Review Comment:
   this file is out of date - 2.72.0 is already released ; i'd suggest we remove this line as this is not a major change to call out.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix IndexError in `apache_beam.utils.processes` when pip subprocess fails with short command [beam]

Posted by "shaheeramjad (via GitHub)" <gi...@apache.org>.
shaheeramjad commented on PR #37536:
URL: https://github.com/apache/beam/pull/37536#issuecomment-3949423455

   > Looks good. Please fix the formatting issue found in the Precommit test.
   
   Have a look Now @shunping 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix IndexError in `apache_beam.utils.processes` when pip subprocess fails with short command [beam]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #37536:
URL: https://github.com/apache/beam/pull/37536#issuecomment-4054733345

   Reminder, please take a look at this pr: @damccorm 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix IndexError in `apache_beam.utils.processes` when pip subprocess fails with short command [beam]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #37536:
URL: https://github.com/apache/beam/pull/37536#issuecomment-4779698307

   This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@beam.apache.org list. Thank you for your contributions.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix IndexError in `apache_beam.utils.processes` when pip subprocess fails with short command [beam]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #37536:
URL: https://github.com/apache/beam/pull/37536#issuecomment-4304400672

   Assigning new set of reviewers because Pr has gone too long without review. If you would like to opt out of this review, comment `assign to next reviewer`:
   
   R: @damccorm for label python.
   
   Available commands:
   - `stop reviewer notifications` - opt out of the automated review tooling
   - `remind me after tests pass` - tag the comment author after tests pass
   - `waiting on author` - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix IndexError in `apache_beam.utils.processes` when pip subprocess fails with short command [beam]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #37536:
URL: https://github.com/apache/beam/pull/37536#issuecomment-4280809637

   Reminder, please take a look at this pr: @shunping 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix IndexError in `apache_beam.utils.processes` when pip subprocess fails with short command [beam]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #37536:
URL: https://github.com/apache/beam/pull/37536#issuecomment-4157173424

   Assigning reviewers:
   
   R: @tvalentyn for label python.
   
   
   Note: If you would like to opt out of this review, comment `assign to next reviewer`.
   
   Available commands:
   - `stop reviewer notifications` - opt out of the automated review tooling
   - `remind me after tests pass` - tag the comment author after tests pass
   - `waiting on author` - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)
   
   The PR bot will only process comments in the main thread (not review comments).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix IndexError in `apache_beam.utils.processes` when pip subprocess fails with short command [beam]

Posted by "shaheeramjad (via GitHub)" <gi...@apache.org>.
shaheeramjad commented on PR #37536:
URL: https://github.com/apache/beam/pull/37536#issuecomment-4160464399

   assign set of reviewers


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix IndexError in `apache_beam.utils.processes` when pip subprocess fails with short command [beam]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #37536:
URL: https://github.com/apache/beam/pull/37536#issuecomment-4855411603

   This pull request has been closed due to lack of activity. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix IndexError in `apache_beam.utils.processes` when pip subprocess fails with short command [beam]

Posted by "shunping (via GitHub)" <gi...@apache.org>.
shunping commented on PR #37536:
URL: https://github.com/apache/beam/pull/37536#issuecomment-3928011866

   Looks like we need to re-evaluate a few failed tests because we get rid of the code path to parse the pip install package.
   
   - TestErrorHandlingCheckCall.test_check_call_pip_install_non_existing_package 
   - TestErrorHandlingCheckCall.test_check_call_pip_short_command_no_index_error
   - TestErrorHandlingCheckOutput.test_check_output_pip_install_non_existing_package
   - TestErrorHandlingCheckOutput.test_check_output_pip_short_command_no_index_error
   - TestErrorHandlingCall.test_call_pip_short_command_no_index_error
   - TestErrorHandlingCall.test_check_output_pip_install_non_existing_package


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix IndexError in `apache_beam.utils.processes` when pip subprocess fails with short command [beam]

Posted by "shunping (via GitHub)" <gi...@apache.org>.
shunping commented on PR #37536:
URL: https://github.com/apache/beam/pull/37536#issuecomment-3939049635

   Looks good. Please fix the formatting issue found in the Precommit test.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix IndexError in `apache_beam.utils.processes` when pip subprocess fails with short command [beam]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #37536:
URL: https://github.com/apache/beam/pull/37536#issuecomment-3914431608

   Reminder, please take a look at this pr: @shunping 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix IndexError in `apache_beam.utils.processes` when pip subprocess fails with short command [beam]

Posted by "shunping (via GitHub)" <gi...@apache.org>.
shunping commented on code in PR #37536:
URL: https://github.com/apache/beam/pull/37536#discussion_r2824010174


##########
sdks/python/apache_beam/utils/multi_process_shared_test.py:
##########
@@ -85,6 +87,7 @@ def __getattribute__(self, __name: str) -> Any:
       return object.__getattribute__(self, __name)
 
 
+@pytest.mark.no_xdist

Review Comment:
   We don't need to add this decorator because this test suite is supposed to run in parallel (as its name suggests)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix IndexError in `apache_beam.utils.processes` when pip subprocess fails with short command [beam]

Posted by "shunping (via GitHub)" <gi...@apache.org>.
shunping commented on PR #37536:
URL: https://github.com/apache/beam/pull/37536#issuecomment-3922814489

   Thanks for contributing to Beam, @shaheeramjad! 
   
   I went back to check `processes.py` and found the code for error handling there was introduced a few years ago at https://github.com/apache/beam/commit/04db8f58e42a05ea6ebafb331bad041422698def
   
   To me, it is very fragile to parse the package name from the argument list, because we can easily make up a example that won't fit. It may be easier to just remove the specific parsing logic for pip and just raise a general traceback.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix IndexError in `apache_beam.utils.processes` when pip subprocess fails with short command [beam]

Posted by "shaheeramjad (via GitHub)" <gi...@apache.org>.
shaheeramjad commented on PR #37536:
URL: https://github.com/apache/beam/pull/37536#issuecomment-4157164120

   assign set of reviewers


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix IndexError in `apache_beam.utils.processes` when pip subprocess fails with short command [beam]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #37536:
URL: https://github.com/apache/beam/pull/37536#issuecomment-4160470170

   Reviewers are already assigned to this PR: @tvalentyn


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org