github.com/apache/beam/sdks/v2@v2.48.2/python/apache_beam/__init__.py (about) 1 # 2 # Licensed to the Apache Software Foundation (ASF) under one or more 3 # contributor license agreements. See the NOTICE file distributed with 4 # this work for additional information regarding copyright ownership. 5 # The ASF licenses this file to You under the Apache License, Version 2.0 6 # (the "License"); you may not use this file except in compliance with 7 # the License. You may obtain a copy of the License at 8 # 9 # http://www.apache.org/licenses/LICENSE-2.0 10 # 11 # Unless required by applicable law or agreed to in writing, software 12 # distributed under the License is distributed on an "AS IS" BASIS, 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 # See the License for the specific language governing permissions and 15 # limitations under the License. 16 # 17 18 """ 19 Apache Beam SDK for Python 20 ========================== 21 22 `Apache Beam <https://beam.apache.org>`_ provides a simple, powerful programming 23 model for building both batch and streaming parallel data processing pipelines. 24 25 The Apache Beam SDK for Python provides access to Apache Beam capabilities 26 from the Python programming language. 27 28 Overview 29 -------- 30 The key concepts in this programming model are 31 32 * :class:`~apache_beam.pvalue.PCollection`: represents a collection of data, 33 which could be bounded or unbounded in size. 34 * :class:`~apache_beam.transforms.ptransform.PTransform`: represents a 35 computation that transforms input PCollections into output PCollections. 36 * :class:`~apache_beam.pipeline.Pipeline`: manages a directed acyclic graph of 37 :class:`~apache_beam.transforms.ptransform.PTransform` s and 38 :class:`~apache_beam.pvalue.PCollection` s that is ready for execution. 39 * :class:`~apache_beam.runners.runner.PipelineRunner`: specifies where and how 40 the pipeline should execute. 41 * :class:`~apache_beam.io.iobase.Read`: read from an external source. 42 * :class:`~apache_beam.io.iobase.Write`: write to an external data sink. 43 44 Typical usage 45 ------------- 46 At the top of your source file:: 47 48 import apache_beam as beam 49 50 After this import statement 51 52 * Transform classes are available as 53 :class:`beam.FlatMap <apache_beam.transforms.core.FlatMap>`, 54 :class:`beam.GroupByKey <apache_beam.transforms.core.GroupByKey>`, etc. 55 * Pipeline class is available as 56 :class:`beam.Pipeline <apache_beam.pipeline.Pipeline>` 57 * Text read/write transforms are available as 58 :class:`beam.io.ReadFromText <apache_beam.io.textio.ReadFromText>`, 59 :class:`beam.io.WriteToText <apache_beam.io.textio.WriteToText>`. 60 61 Examples 62 -------- 63 The `examples subdirectory 64 <https://github.com/apache/beam/tree/master/sdks/python/apache_beam/examples>`_ 65 has some examples. 66 67 """ 68 69 import sys 70 import warnings 71 72 if sys.version_info.major == 3: 73 if sys.version_info.minor <= 6 or sys.version_info.minor >= 12: 74 warnings.warn( 75 'This version of Apache Beam has not been sufficiently tested on ' 76 'Python %s.%s. You may encounter bugs or missing features.' % 77 (sys.version_info.major, sys.version_info.minor)) 78 pass 79 else: 80 raise RuntimeError( 81 'The Apache Beam SDK for Python is only supported on Python 3. ' 82 'It is not supported on Python [' + str(sys.version_info) + '].') 83 84 # pylint: disable=wrong-import-position 85 import apache_beam.internal.pickler 86 87 from apache_beam import coders 88 from apache_beam import io 89 from apache_beam import metrics 90 from apache_beam import typehints 91 from apache_beam import version 92 from apache_beam.pipeline import Pipeline 93 from apache_beam.transforms import * 94 from apache_beam.pvalue import PCollection 95 from apache_beam.pvalue import Row 96 from apache_beam.pvalue import TaggedOutput 97 # pylint: enable=wrong-import-position 98 99 __version__ = version.__version__