Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Python 3.8 Support from Apache Beam #32643

Merged
merged 4 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/beam_Publish_Beam_SDK_Snapshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ jobs:
- "java:container:java11"
- "java:container:java17"
- "java:container:java21"
- "python:container:py38"
- "python:container:py39"
- "python:container:py310"
- "python:container:py311"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
env:
EVENT_NAME: ${{ github.event_name }}
# Keep in sync with py_version matrix value below - if changed, change that as well.
PY_VERSIONS_FULL: "cp38-* cp39-* cp310-* cp311-* cp312-*"
PY_VERSIONS_FULL: "cp39-* cp310-* cp311-* cp312-*"
outputs:
gcp-variables-set: ${{ steps.check_gcp_variables.outputs.gcp-variables-set }}
py-versions-full: ${{ steps.set-py-versions.outputs.py-versions-full }}
Expand Down Expand Up @@ -229,7 +229,7 @@ jobs:
{"os": "ubuntu-20.04", "runner": [self-hosted, ubuntu-20.04, main], "python": "${{ needs.check_env_variables.outputs.py-versions-test }}", arch: "aarch64" }
]
# Keep in sync (remove asterisks) with PY_VERSIONS_FULL env var above - if changed, change that as well.
py_version: ["cp38-", "cp39-", "cp310-", "cp311-", "cp312-"]
py_version: ["cp39-", "cp310-", "cp311-", "cp312-"]
steps:
- name: Download python source distribution from artifacts
uses: actions/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion .test-infra/jenkins/metrics_report/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
; TODO(https://github.com/apache/beam/issues/20209): Don't hardcode Py3.8 version.
[tox]
skipsdist = True
envlist = py38-test,py38-generate-report
envlist = py39-test,py39-generate-report

[testenv]
commands_pre =
Expand Down
2 changes: 1 addition & 1 deletion .test-infra/mock-apis/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ packages = [
]

[tool.poetry.dependencies]
python = "^3.8"
python = "^3.9"
google = "^3.0.0"
grpcio = "^1.53.0"
grpcio-tools = "^1.53.0"
Expand Down
2 changes: 1 addition & 1 deletion .test-infra/tools/python_installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
set -euo pipefail

# Variable containing the python versions to install
python_versions_arr=("3.8.16" "3.9.16" "3.10.10" "3.11.4")
python_versions_arr=("3.9.16" "3.10.10" "3.11.4", "3.12.6")

# Install pyenv dependencies.
pyenv_dep(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3145,7 +3145,6 @@ class BeamModulePlugin implements Plugin<Project> {
mustRunAfter = [
":runners:flink:${project.ext.latestFlinkVersion}:job-server:shadowJar",
':runners:spark:3:job-server:shadowJar',
':sdks:python:container:py38:docker',
':sdks:python:container:py39:docker',
':sdks:python:container:py310:docker',
':sdks:python:container:py311:docker',
Expand Down
2 changes: 1 addition & 1 deletion contributor-docs/release-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ with tags: `${RELEASE_VERSION}rc${RC_NUM}`
Verify that third party licenses are included in Docker. You can do this with a simple script:

RC_TAG=${RELEASE_VERSION}rc${RC_NUM}
for pyver in 3.8 3.9 3.10 3.11; do
for pyver in 3.9 3.10 3.11 3.12; do
docker run --rm --entrypoint sh \
apache/beam_python${pyver}_sdk:${RC_TAG} \
-c 'ls -al /opt/apache/beam/third_party_licenses/ | wc -l'
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ docker_image_default_repo_prefix=beam_
# supported flink versions
flink_versions=1.15,1.16,1.17,1.18
# supported python versions
python_versions=3.8,3.9,3.10,3.11,3.12
python_versions=3.9,3.10,3.11,3.12
4 changes: 2 additions & 2 deletions local-env-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ if [ "$kernelname" = "Linux" ]; then
exit
fi

for ver in 3.8 3.9 3.10 3.11 3.12 3; do
for ver in 3.9 3.10 3.11 3.12 3; do
apt install --yes python$ver-venv
done

Expand Down Expand Up @@ -89,7 +89,7 @@ elif [ "$kernelname" = "Darwin" ]; then
echo "Installing openjdk@8"
brew install openjdk@8
fi
for ver in 3.8 3.9 3.10 3.11 3.12; do
for ver in 3.9 3.10 3.11 3.12; do
if brew ls --versions python@$ver > /dev/null; then
echo "python@$ver already installed. Skipping"
brew info python@$ver
Expand Down
10 changes: 5 additions & 5 deletions playground/infrastructure/cloudbuild/playground_cd_examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ LogOutput "Installing python and dependencies."
export DEBIAN_FRONTEND=noninteractive
apt install -y apt-transport-https ca-certificates software-properties-common curl unzip apt-utils > /dev/null 2>&1
add-apt-repository -y ppa:deadsnakes/ppa > /dev/null 2>&1 && apt update > /dev/null 2>&1
apt install -y python3.8 python3.8-distutils python3-pip > /dev/null 2>&1
apt install -y --reinstall python3.8-distutils > /dev/null 2>&1
apt install -y python3.9 python3-distutils python3-pip > /dev/null 2>&1
apt install -y --reinstall python3-distutils > /dev/null 2>&1
apt install -y python3-virtualenv
virtualenv play_venv
source play_venv/bin/activate
pip install --upgrade google-api-python-client > /dev/null 2>&1
python3.8 -m pip install pip --upgrade > /dev/null 2>&1
ln -s /usr/bin/python3.8 /usr/bin/python > /dev/null 2>&1
apt install -y python3.8-venv > /dev/null 2>&1
python3.9 -m pip install pip --upgrade > /dev/null 2>&1
ln -s /usr/bin/python3.9 /usr/bin/python > /dev/null 2>&1
apt install -y python3.9-venv > /dev/null 2>&1

LogOutput "Installing Python packages from beam/playground/infrastructure/requirements.txt"
cd $BEAM_ROOT_DIR
Expand Down
10 changes: 5 additions & 5 deletions playground/infrastructure/cloudbuild/playground_ci_examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ export DEBIAN_FRONTEND=noninteractive
LogOutput "Installing Python environment"
apt-get install -y apt-transport-https ca-certificates software-properties-common curl unzip apt-utils > /dev/null
add-apt-repository -y ppa:deadsnakes/ppa > /dev/null && apt update > /dev/null
apt install -y python3.8 python3.8-distutils python3-pip > /dev/null
apt install --reinstall python3.8-distutils > /dev/null
apt install -y python3.9 python3-distutils python3-pip > /dev/null
apt install --reinstall python3-distutils > /dev/null
pip install --upgrade google-api-python-client > /dev/null
python3.8 -m pip install pip --upgrade > /dev/null
ln -s /usr/bin/python3.8 /usr/bin/python > /dev/null
apt install python3.8-venv > /dev/null
python3.9 -m pip install pip --upgrade > /dev/null
ln -s /usr/bin/python3.9 /usr/bin/python > /dev/null
apt install python3.9-venv > /dev/null
LogOutput "Installing Python packages from beam/playground/infrastructure/requirements.txt"
pip install -r $BEAM_ROOT_DIR/playground/infrastructure/requirements.txt

Expand Down
3 changes: 1 addition & 2 deletions release/src/main/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,11 @@ RUN curl https://pyenv.run | bash && \
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> /root/.bashrc && \
echo ''eval "$(pyenv init -)"'' >> /root/.bashrc && \
source /root/.bashrc && \
pyenv install 3.8.9 && \
pyenv install 3.9.4 && \
pyenv install 3.10.7 && \
pyenv install 3.11.3 && \
pyenv install 3.12.3 && \
pyenv global 3.8.9 3.9.4 3.10.7 3.11.3 3.12.3
pyenv global 3.9.4 3.10.7 3.11.3 3.12.3

# Install a Go version >= 1.16 so we can bootstrap higher
# Go versions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
source release/src/main/python-release/run_release_candidate_python_quickstart.sh
source release/src/main/python-release/run_release_candidate_python_mobile_gaming.sh

for version in 3.8 3.9 3.10 3.11 3.12
for version in 3.9 3.10 3.11 3.12
do
run_release_candidate_python_quickstart "tar" "python${version}"
run_release_candidate_python_mobile_gaming "tar" "python${version}"
Expand Down
8 changes: 1 addition & 7 deletions sdks/python/apache_beam/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,11 @@
import warnings

if sys.version_info.major == 3:
if sys.version_info.minor <= 7 or sys.version_info.minor >= 13:
if sys.version_info.minor <= 8 or sys.version_info.minor >= 13:
warnings.warn(
'This version of Apache Beam has not been sufficiently tested on '
'Python %s.%s. You may encounter bugs or missing features.' %
(sys.version_info.major, sys.version_info.minor))
elif sys.version_info.minor == 8:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also change the boundaries of the above condition to include 3.8

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

warnings.warn(
'Python 3.8 reaches EOL in October 2024 and support will '
'be removed from Apache Beam in version 2.61.0. See '
'https://github.com/apache/beam/issues/31192 for more '
'information.')
pass
else:
raise RuntimeError(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ RUN pip install openai vllm
RUN apt install libcairo2-dev pkg-config python3-dev -y
RUN pip install pycairo

# Copy the Apache Beam worker dependencies from the Beam Python 3.8 SDK image.
# Copy the Apache Beam worker dependencies from the Beam Python 3.12 SDK image.
COPY --from=apache/beam_python3.12_sdk:2.58.1 /opt/apache/beam /opt/apache/beam

# Set the entrypoint to Apache Beam SDK worker launcher.
Expand Down
2 changes: 1 addition & 1 deletion sdks/python/expansion-service-container/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
###############################################################################

# We just need to support one Python version supported by Beam.
# Picking the current default Beam Python version which is Python 3.8.
# Picking the current default Beam Python version which is Python 3.9.
FROM python:3.9-bookworm as expansion-service
LABEL Author "Apache Beam <[email protected]>"
ARG TARGETOS
Expand Down
12 changes: 3 additions & 9 deletions sdks/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def cythonize(*args, **kwargs):
# Exclude 1.5.0 and 1.5.1 because of
# https://github.com/pandas-dev/pandas/issues/45725
dataframe_dependency = [
'pandas>=1.4.3,!=1.5.0,!=1.5.1,<2.3;python_version>="3.8"',
'pandas>=1.4.3,!=1.5.0,!=1.5.1,<2.3',
]


Expand Down Expand Up @@ -271,18 +271,13 @@ def get_portability_package_data():
return files


python_requires = '>=3.8'
python_requires = '>=3.9'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(drive by): line 276 should have >= 13 or > 12

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed


if sys.version_info.major == 3 and sys.version_info.minor >= 12:
if sys.version_info.major == 3 and sys.version_info.minor >= 13:
warnings.warn(
'This version of Apache Beam has not been sufficiently tested on '
'Python %s.%s. You may encounter bugs or missing features.' %
(sys.version_info.major, sys.version_info.minor))
elif sys.version_info.major == 3 and sys.version_info.minor == 8:
warnings.warn('Python 3.8 reaches EOL in October 2024 and support will '
'be removed from Apache Beam in version 2.61.0. See '
'https://github.com/apache/beam/issues/31192 for more '
'information.')

if __name__ == '__main__':
# In order to find the tree of proto packages, the directory
Expand Down Expand Up @@ -534,7 +529,6 @@ def get_portability_package_data():
'Intended Audience :: End Users/Desktop',
'License :: OSI Approved :: Apache Software License',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
Expand Down
Loading