From e87bee28abe952b7ae5145f2d42ffae37f40b088 Mon Sep 17 00:00:00 2001 From: Danny Mccormick Date: Tue, 13 May 2025 15:30:57 -0400 Subject: [PATCH 1/2] Disable argument abbreviation in Python --- CHANGES.md | 1 + sdks/python/apache_beam/options/pipeline_options.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 1cefcd936322..a51941f38def 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -84,6 +84,7 @@ * X behavior was changed ([#X](https://github.com/apache/beam/issues/X)). * Yapf version upgraded to 0.43.0 for formatting (Python) ([#34801](https://github.com/apache/beam/pull/34801/)). * Python: Added JupyterLab 4.x extension compatibility for enhanced notebook integration ([#34495](https://github.com/apache/beam/pull/34495)). +* Python: Argument abbreviation is no longer enabled within Beam. If you previously abbreviated argument (e.g. `--r` for `--runner`), you will now need to specify the whole argument ([#34934](https://github.com/apache/beam/pull/34934)) ## Deprecations diff --git a/sdks/python/apache_beam/options/pipeline_options.py b/sdks/python/apache_beam/options/pipeline_options.py index b51b85963c69..f41d63bea4ac 100644 --- a/sdks/python/apache_beam/options/pipeline_options.py +++ b/sdks/python/apache_beam/options/pipeline_options.py @@ -290,7 +290,7 @@ def __init__(self, flags: Optional[Sequence[str]] = None, **kwargs) -> None: # Build parser that will parse options recognized by the [sub]class of # PipelineOptions whose object is being instantiated. - parser = _BeamArgumentParser() + parser = _BeamArgumentParser(allow_abbrev=False) for cls in type(self).mro(): if cls == PipelineOptions: break @@ -405,7 +405,7 @@ def get_all_options( # sub-classes in the main session might be repeated. Pick last unique # instance of each subclass to avoid conflicts. subset = {} - parser = _BeamArgumentParser() + parser = _BeamArgumentParser(allow_abbrev=False) for cls in PipelineOptions.__subclasses__(): subset[str(cls)] = cls for cls in subset.values(): From a3373034b77f518b52d84ace4c6a584d11650d3c Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Wed, 14 May 2025 15:43:44 -0400 Subject: [PATCH 2/2] Grammar Co-authored-by: tvalentyn --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index a51941f38def..fd03ae4d3889 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -84,7 +84,7 @@ * X behavior was changed ([#X](https://github.com/apache/beam/issues/X)). * Yapf version upgraded to 0.43.0 for formatting (Python) ([#34801](https://github.com/apache/beam/pull/34801/)). * Python: Added JupyterLab 4.x extension compatibility for enhanced notebook integration ([#34495](https://github.com/apache/beam/pull/34495)). -* Python: Argument abbreviation is no longer enabled within Beam. If you previously abbreviated argument (e.g. `--r` for `--runner`), you will now need to specify the whole argument ([#34934](https://github.com/apache/beam/pull/34934)) +* Python: Argument abbreviation is no longer enabled within Beam. If you previously abbreviated arguments (e.g. `--r` for `--runner`), you will now need to specify the whole argument ([#34934](https://github.com/apache/beam/pull/34934)). ## Deprecations