blob: f51218327676b39a90db00a62d4f75c7fb2b9a0e [file] [log] [blame] [view]
---
type: languages
title: "Apache Beam Python SDK"
---
<!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
# Apache Beam Python SDK
The Python SDK for Apache Beam provides a simple, powerful API for building batch and streaming data processing pipelines.
## Get started with the Python SDK
Get started with the [Beam Python SDK quickstart](/get-started/quickstart-py) to set up your Python development environment, get the Beam SDK for Python, and run an example pipeline. Then, read through the [Beam programming guide](/documentation/programming-guide) to learn the basic concepts that apply to all SDKs in Beam.
See the [Python API reference](https://beam.apache.org/releases/pydoc/) for more information on individual APIs.
## Python streaming pipelines
Python [streaming pipeline execution](/documentation/sdks/python-streaming)
is available (with some [limitations](/documentation/sdks/python-streaming/#unsupported-features))
starting with Beam SDK version 2.5.0.
## Python type safety
Python is a dynamically-typed language with no static type checking. The Beam SDK for Python uses type hints during pipeline construction and runtime to try to emulate the correctness guarantees achieved by true static typing. [Ensuring Python Type Safety](/documentation/sdks/python-type-safety) walks through how to use type hints, which help you to catch potential bugs up front with the [Direct Runner](/documentation/runners/direct/).
## Managing Python pipeline dependencies
When you run your pipeline locally, the packages that your pipeline depends on are available because they are installed on your local machine. However, when you want to run your pipeline remotely, you must make sure these dependencies are available on the remote machines. [Managing Python Pipeline Dependencies](/documentation/sdks/python-pipeline-dependencies) shows you how to make your dependencies available to the remote workers.
## Developing new I/O connectors for Python
The Beam SDK for Python provides an extensible API that you can use to create
new I/O connectors. See the [Developing I/O connectors overview](/documentation/io/developing-io-overview)
for information about developing new I/O connectors and links to
language-specific implementation guidance.
## Making machine learning inferences with Python
To integrate machine learning models into your pipelines for making inferences, use the RunInference API for PyTorch and Scikit-learn models. If you are using TensorFlow models, you can make use of the
[library from `tfx_bsl`](https://github.com/tensorflow/tfx-bsl/tree/master/tfx_bsl/beam).
You can create multiple types of transforms using the RunInference API: the API takes multiple types of setup parameters from model handlers, and the parameter type determines the model implementation. For more information,
see [About Beam ML](/documentation/ml/about-ml).
[TensorFlow Extended (TFX)](https://www.tensorflow.org/tfx) is an end-to-end platform for deploying production ML pipelines. TFX is integrated with Beam. For more information, see [TFX user guide](https://www.tensorflow.org/tfx/guide).
## Python multi-language pipelines quickstart
Apache Beam lets you combine transforms written in any supported SDK language and use them in one multi-language pipeline. To learn how to create a multi-language pipeline using the Python SDK, see the [Python multi-language pipelines quickstart](/documentation/sdks/python-multi-language-pipelines).
## Unrecoverable Errors in Beam Python
Some common errors can occur during worker start-up and prevent jobs from starting. To learn about these errors and how to troubleshoot them in the Python SDK, see [Unrecoverable Errors in Beam Python](/documentation/sdks/python-unrecoverable-errors).