You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "ShreyPatel4 (via GitHub)" <gi...@apache.org> on 2025/10/15 17:56:31 UTC

[PR] [Python]: accepts --serviceAccount as alias of --service_account_email [beam]

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

   # Python: accept --serviceAccount as alias of --service_account_email
   
   - **Fixes:** #19278
   - **Relates to:** #36173 (Beam 3.0.0 – Milestone 1 consistency work)
   
   ## Summary
   - Adds the Java-style flag `--serviceAccount` as an alias for the existing Python flag `--service_account_email` in [GoogleCloudOptions](cci:2://file:///home/shreypatel/OpSrc/beam/sdks/python/apache_beam/options/pipeline_options.py:970:0-1263:15).
   - Both flags map to the same destination `service_account_email` and behave identically.
   
   ## Motivation
   - **Consistency across SDKs:** Java commonly uses `--serviceAccount`. Aligning Python reduces friction for users moving between SDKs or reusing scripts.
   - **Improved UX:** Prevents “unknown option” errors when users copy examples from Java or shared docs.
   - **Non-breaking change:** Existing `--service_account_email` remains fully supported.
   
   ## Changes
   - **Flag alias added**
     - File: [sdks/python/apache_beam/options/pipeline_options.py](cci:7://file:///home/shreypatel/OpSrc/beam/sdks/python/apache_beam/options/pipeline_options.py:0:0-0:0)
     - Class: [GoogleCloudOptions](cci:2://file:///home/shreypatel/OpSrc/beam/sdks/python/apache_beam/options/pipeline_options.py:970:0-1263:15)
     - Method: [GoogleCloudOptions._add_argparse_args()](cci:1://file:///home/shreypatel/OpSrc/beam/sdks/python/apache_beam/options/pipeline_options.py:987:2-1163:80)
     - Change: accept both flags while mapping to the same destination
       ```python
       parser.add_argument(
           '--service_account_email', '--serviceAccount',
           dest='service_account_email',
           default=None,
           help='Identity to run virtual machines as.')
       ```
   
   - **Unit tests added**
     - File: [sdks/python/apache_beam/options/pipeline_options_test.py](cci:7://file:///home/shreypatel/OpSrc/beam/sdks/python/apache_beam/options/pipeline_options_test.py:0:0-0:0)
     - Tests:
       - [PipelineOptionsTest.test_service_account_alias_camelCase](cci:1://file:///home/shreypatel/OpSrc/beam/sdks/python/apache_beam/options/pipeline_options_test.py:977:2-980:66)
       - [PipelineOptionsTest.test_service_account_snake_case_still_works](cci:1://file:///home/shreypatel/OpSrc/beam/sdks/python/apache_beam/options/pipeline_options_test.py:982:2-985:67)
     - Purpose: Verify that both `--serviceAccount` and `--service_account_email` set `GoogleCloudOptions.service_account_email`.
   
   
   
   ------------------------
   
   Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
   
    - [ ] 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.
    - [ ] 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] [Python]: accepts --serviceAccount as alias of --service_account_email [beam]

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

   ## Summary of Changes
   
   Hello @ShreyPatel4, 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 introduces an alias for the `--service_account_email` command-line flag in the Python SDK, allowing `--serviceAccount` to be used interchangeably. This enhancement aims to improve consistency across Beam's SDKs, particularly with Java, and enhance the user experience by preventing errors when users port configurations or scripts. The change is non-breaking and includes dedicated unit tests to ensure proper functionality of both the new alias and the original flag.
   
   ### Highlights
   
   * **Flag Alias**: The `--serviceAccount` flag is now accepted as an alias for `--service_account_email` in `GoogleCloudOptions` within the Python SDK.
   * **Consistency**: This change improves consistency with the Java SDK, which commonly uses `--serviceAccount`, reducing friction for users moving between SDKs or reusing scripts.
   * **User Experience**: It prevents "unknown option" errors when users adapt examples or scripts from Java or shared documentation.
   * **Non-breaking Change**: The existing `--service_account_email` flag remains fully supported, ensuring backward compatibility.
   * **Testing**: New unit tests have been added to verify that both `--serviceAccount` and `--service_account_email` correctly set the `service_account_email` property.
   
   
   
   
   
   
   
   <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] [Python]: accepts --serviceAccount as alias of --service_account_email [beam]

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

   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] [Python]: accepts --serviceAccount as alias of --service_account_email [beam]

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


##########
sdks/python/apache_beam/options/pipeline_options.py:
##########
@@ -1023,7 +1023,7 @@ def _add_argparse_args(cls, parser):
         help='The Google Compute Engine region for creating '
         'Dataflow job.')
     parser.add_argument(
-        '--service_account_email',
+        '--service_account_email', '--serviceAccount',

Review Comment:
   it should be `--service_account`, as Python option uses underscores. It is automatically converted to camel cases when passed to java



-- 
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] [Python]: accepts --serviceAccount as alias of --service_account_email [beam]

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

   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] [Python]: accepts --serviceAccount as alias of --service_account_email [beam]

Posted by "ShreyPatel4 (via GitHub)" <gi...@apache.org>.
ShreyPatel4 closed pull request #36529: [Python]: accepts --serviceAccount as alias of --service_account_email
URL: https://github.com/apache/beam/pull/36529


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