[BEAM-1345] Clearly delineate public API in apache_beam/options
Project: http://git-wip-us.apache.org/repos/asf/beam/repo Commit: http://git-wip-us.apache.org/repos/asf/beam/commit/6d77f958 Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/6d77f958 Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/6d77f958 Branch: refs/heads/release-2.0.0 Commit: 6d77f958de666ccf5f59e907c292efbc9272b49b Parents: 0a0cc2d Author: Charles Chen <[email protected]> Authored: Thu May 11 13:31:18 2017 -0700 Committer: Ahmet Altay <[email protected]> Committed: Thu May 11 16:20:36 2017 -0700 ---------------------------------------------------------------------- .../apache_beam/options/pipeline_options.py | 20 +++++++++++++++++--- .../options/pipeline_options_validator.py | 2 ++ .../apache_beam/options/value_provider.py | 8 ++++++++ 3 files changed, 27 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/beam/blob/6d77f958/sdks/python/apache_beam/options/pipeline_options.py ---------------------------------------------------------------------- diff --git a/sdks/python/apache_beam/options/pipeline_options.py b/sdks/python/apache_beam/options/pipeline_options.py index b79d85d..983d128 100644 --- a/sdks/python/apache_beam/options/pipeline_options.py +++ b/sdks/python/apache_beam/options/pipeline_options.py @@ -25,6 +25,20 @@ from apache_beam.options.value_provider import RuntimeValueProvider from apache_beam.options.value_provider import ValueProvider +__all__ = [ + 'PipelineOptions', + 'StandardOptions', + 'TypeOptions', + 'DirectOptions', + 'GoogleCloudOptions', + 'WorkerOptions', + 'DebugOptions', + 'ProfilingOptions', + 'SetupOptions', + 'TestOptions', + ] + + def _static_value_provider_of(value_type): """"Helper function to plug a ValueProvider into argparse. @@ -42,7 +56,7 @@ def _static_value_provider_of(value_type): return _f -class BeamArgumentParser(argparse.ArgumentParser): +class _BeamArgumentParser(argparse.ArgumentParser): """An ArgumentParser that supports ValueProvider options. Example Usage:: @@ -133,7 +147,7 @@ class PipelineOptions(HasDisplayData): """ self._flags = flags self._all_options = kwargs - parser = BeamArgumentParser() + parser = _BeamArgumentParser() for cls in type(self).mro(): if cls == PipelineOptions: @@ -187,7 +201,7 @@ class PipelineOptions(HasDisplayData): # TODO(BEAM-1319): PipelineOption sub-classes in the main session might be # repeated. Pick last unique instance of each subclass to avoid conflicts. subset = {} - parser = BeamArgumentParser() + parser = _BeamArgumentParser() for cls in PipelineOptions.__subclasses__(): subset[str(cls)] = cls for cls in subset.values(): http://git-wip-us.apache.org/repos/asf/beam/blob/6d77f958/sdks/python/apache_beam/options/pipeline_options_validator.py ---------------------------------------------------------------------- diff --git a/sdks/python/apache_beam/options/pipeline_options_validator.py b/sdks/python/apache_beam/options/pipeline_options_validator.py index 5c1ce2a..24d2e55 100644 --- a/sdks/python/apache_beam/options/pipeline_options_validator.py +++ b/sdks/python/apache_beam/options/pipeline_options_validator.py @@ -16,6 +16,8 @@ # """Pipeline options validator. + +For internal use only; no backwards-compatibility guarantees. """ import re http://git-wip-us.apache.org/repos/asf/beam/blob/6d77f958/sdks/python/apache_beam/options/value_provider.py ---------------------------------------------------------------------- diff --git a/sdks/python/apache_beam/options/value_provider.py b/sdks/python/apache_beam/options/value_provider.py index c00d7bc..40bddba 100644 --- a/sdks/python/apache_beam/options/value_provider.py +++ b/sdks/python/apache_beam/options/value_provider.py @@ -24,6 +24,14 @@ from functools import wraps from apache_beam import error +__all__ = [ + 'ValueProvider', + 'StaticValueProvider', + 'RuntimeValueProvider', + 'check_accessible', + ] + + class ValueProvider(object): def is_accessible(self): raise NotImplementedError(
