From f5a293768fcb480ac577e703d576f333f66ab80c Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Wed, 20 Nov 2024 08:22:14 -0800 Subject: [PATCH] Drop Python 3.8 support This was previously announced in https://engdoc.corp.google.com/eng/doc/devguide/proto/news/2024-10-02.md#dropping-python-38-support per our support policies. #test-continuous PiperOrigin-RevId: 698398370 --- .github/workflows/test_python.yml | 6 ++---- .github/workflows/test_upb.yml | 12 ++++------- MODULE.bazel | 1 - protobuf_deps.bzl | 14 +++---------- python/BUILD.bazel | 33 +++--------------------------- python/dist/BUILD.bazel | 17 ++++++--------- python/dist/setup.py | 3 +-- python/dist/system_python.bzl | 2 +- python/protobuf_distutils/setup.py | 1 - python/py_extension.bzl | 4 +--- 10 files changed, 21 insertions(+), 72 deletions(-) diff --git a/.github/workflows/test_python.yml b/.github/workflows/test_python.yml index 43db179ed2..4de8143ced 100644 --- a/.github/workflows/test_python.yml +++ b/.github/workflows/test_python.yml @@ -28,7 +28,7 @@ jobs: fail-fast: false # Don't cancel all jobs if one fails. matrix: type: [ Pure, C++] - version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] + version: ["3.9", "3.10", "3.11", "3.12", "3.13"] include: - type: Pure targets: //python/... //python:python_version_test @@ -42,9 +42,7 @@ jobs: # TODO Enable this once conformance tests are fixed. flags: --define=use_fast_cpp_protos=true --test_tag_filters=-conformance image: us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:aarch64-63dd26c0c7a808d92673a3e52e848189d4ab0f17 - - version: "3.8" - version: "3.9" - continuous-only: true - version: "3.10" continuous-only: true - version: "3.11" @@ -65,7 +63,7 @@ jobs: if: ${{ !matrix.continuous-only || inputs.continuous-run }} uses: protocolbuffers/protobuf-ci/bazel-docker@v3 with: - image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/python:6.4.0-{0}-d9624f2aa83cba3eaf906f751d75b36aacb9aa82', matrix.version) }} + image: ${{ matrix.image || format('us-docker.pkg.dev/protobuf-build/containers/test/linux/python:7.1.2-{0}-d9624f2aa83cba3eaf906f751d75b36aacb9aa82', matrix.version) }} credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: python_linux/${{ matrix.type }}_${{ matrix.version }} bazel: test ${{ matrix.targets }} ${{ matrix.flags }} --test_env=KOKORO_PYTHON_VERSION diff --git a/.github/workflows/test_upb.yml b/.github/workflows/test_upb.yml index a6ef3604ca..3b918ad3e3 100644 --- a/.github/workflows/test_upb.yml +++ b/.github/workflows/test_upb.yml @@ -188,26 +188,22 @@ jobs: # a single wheel. As a result we can just test the oldest and newest # supported Python versions and assume this gives us sufficient test # coverage. - - { os: ubuntu-latest, python-version: "3.8", architecture: x64, type: 'binary' } - - { os: macos-13, python-version: "3.8", architecture: x64, type: 'binary' } + - { os: ubuntu-latest, python-version: "3.9", architecture: x64, type: 'binary' } + - { os: macos-13, python-version: "3.9", architecture: x64, type: 'binary' } - { os: ubuntu-latest, python-version: "3.12", architecture: x64, type: 'binary' } - { os: macos-13, python-version: "3.12", architecture: x64, type: 'binary' } - - { os: ubuntu-latest, python-version: "3.8", architecture: x64, type: 'source', continuous-only: true } - - { os: macos-13, python-version: "3.8", architecture: x64, type: 'source', continuous-only: true } - { os: ubuntu-latest, python-version: "3.12", architecture: x64, type: 'source', continuous-only: true } - { os: macos-13, python-version: "3.12", architecture: x64, type: 'source', continuous-only: true } - { os: ubuntu-latest, python-version: "3.13", architecture: x64, type: 'source', continuous-only: true } - { os: macos-13, python-version: "3.13", architecture: x64, type: 'source', continuous-only: true } # Windows uses the full API up until Python 3.10. - - { os: windows-2019, python-version: "3.8", architecture: x86, type: 'binary', continuous-only: true } - { os: windows-2019, python-version: "3.9", architecture: x86, type: 'binary', continuous-only: true } - { os: windows-2019, python-version: "3.10", architecture: x86, type: 'binary', continuous-only: true } - { os: windows-2019, python-version: "3.11", architecture: x86, type: 'binary', continuous-only: true } - { os: windows-2019, python-version: "3.12", architecture: x86, type: 'binary', continuous-only: true } - { os: windows-2019, python-version: "3.13", architecture: x86, type: 'binary', continuous-only: true } - - { os: windows-2019, python-version: "3.8", architecture: x64, type: 'binary' } - - { os: windows-2019, python-version: "3.9", architecture: x64, type: 'binary', continuous-only: true } + - { os: windows-2019, python-version: "3.9", architecture: x64, type: 'binary' } - { os: windows-2019, python-version: "3.10", architecture: x64, type: 'binary', continuous-only: true } - { os: windows-2019, python-version: "3.11", architecture: x64, type: 'binary', continuous-only: true } - { os: windows-2019, python-version: "3.12", architecture: x64, type: 'binary', continuous-only: true } @@ -283,7 +279,7 @@ jobs: strategy: fail-fast: false # Don't cancel all jobs if one fails. matrix: - python-version: ["3.8", "3.13"] + python-version: ["3.9", "3.13"] runs-on: ubuntu-latest if: ${{ github.event_name != 'pull_request_target' }} steps: diff --git a/MODULE.bazel b/MODULE.bazel index 05bbeb590e..30b1d815fc 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -36,7 +36,6 @@ bazel_dep( register_toolchains("//bazel/private/toolchains:all") SUPPORTED_PYTHON_VERSIONS = [ - "3.8", "3.9", "3.10", "3.11", diff --git a/protobuf_deps.bzl b/protobuf_deps.bzl index 2c461bfdc3..a2b531badb 100644 --- a/protobuf_deps.bzl +++ b/protobuf_deps.bzl @@ -124,7 +124,7 @@ def protobuf_deps(): if not native.existing_rule("system_python"): system_python( name = "system_python", - minimum_python_version = "3.8", + minimum_python_version = "3.9", ) if not native.existing_rule("rules_jvm_external"): @@ -178,16 +178,8 @@ def protobuf_deps(): # Python Downloads python_source_archive( - name = "python-3.8.0", - sha256 = "f1069ad3cae8e7ec467aa98a6565a62a48ef196cb8f1455a245a08db5e1792df", - ) - python_nuget_package( - name = "nuget_python_i686_3.8.0", - sha256 = "87a6481f5eef30b42ac12c93f06f73bd0b8692f26313b76a6615d1641c4e7bca", - ) - python_nuget_package( - name = "nuget_python_x86-64_3.8.0", - sha256 = "96c61321ce90dd053c8a04f305a5f6cc6d91350b862db34440e4a4f069b708a0", + name = "python-3.9.0", + sha256 = "df796b2dc8ef085edae2597a41c1c0a63625ebd92487adaef2fed22b567873e8", ) python_nuget_package( name = "nuget_python_i686_3.9.0", diff --git a/python/BUILD.bazel b/python/BUILD.bazel index 6131ab92c9..4ccb437f3b 100644 --- a/python/BUILD.bazel +++ b/python/BUILD.bazel @@ -22,7 +22,7 @@ package( ) LIMITED_API_FLAG_SELECT = { - ":limited_api_3.8": ["-DPy_LIMITED_API=0x03080000"], + ":limited_api_3.9": ["-DPy_LIMITED_API=0x03090000"], ":limited_api_3.10": ["-DPy_LIMITED_API=0x030a0000"], "//conditions:default": [], } @@ -37,7 +37,6 @@ string_flag( build_setting_default = "system", values = [ "system", - "38", "39", "310", "311", @@ -45,37 +44,11 @@ string_flag( ) config_setting( - name = "limited_api_3.8", + name = "limited_api_3.9", flag_values = { ":limited_api": "True", - ":python_version": "38", - }, -) - -config_setting( - name = "full_api_3.8_win32", - flag_values = { - ":limited_api": "False", - ":python_version": "38", - }, - values = {"cpu": "win32"}, -) - -config_setting( - name = "full_api_3.8_win64", - flag_values = { - ":limited_api": "False", - ":python_version": "38", + ":python_version": "39", }, - values = {"cpu": "win64"}, -) - -selects.config_setting_group( - name = "full_api_3.8", - match_any = [ - ":full_api_3.8_win32", - ":full_api_3.8_win64", - ], ) config_setting( diff --git a/python/dist/BUILD.bazel b/python/dist/BUILD.bazel index 6b335f105b..cb913fc8cf 100644 --- a/python/dist/BUILD.bazel +++ b/python/dist/BUILD.bazel @@ -301,7 +301,6 @@ genrule( py_wheel( name = "binary_wheel", abi = select({ - "//python:full_api_3.8": "cp38", "//python:full_api_3.9": "cp39", "//conditions:default": "abi3", }), @@ -310,7 +309,6 @@ py_wheel( classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -334,11 +332,10 @@ py_wheel( ":windows_x86_64": "win_amd64", "//conditions:default": "any", }), - python_requires = ">=3.8", + python_requires = ">=3.9", # LINT.IfChange(python_tag) python_tag = selects.with_or({ - ("//python:limited_api_3.8", "//python:full_api_3.8"): "cp38", - "//python:full_api_3.9": "cp39", + ("//python:limited_api_3.9", "//python:full_api_3.9"): "cp39", "//python:limited_api_3.10": "cp310", "//conditions:default": "cp" + SYSTEM_PYTHON_VERSION, }), @@ -372,7 +369,6 @@ py_wheel( classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -386,7 +382,7 @@ py_wheel( homepage = "https://developers.google.com/protocol-buffers/", license = "3-Clause BSD License", platform = "any", - python_requires = ">=3.8", + python_requires = ">=3.9", python_tag = "py3", strip_path_prefixes = [ "python/", @@ -442,7 +438,6 @@ py_dist( # Windows needs version-specific wheels until 3.10. # LINT.IfChange(full_api_version) full_api_versions = [ - "38", "39", ], # LINT.ThenChange(:python_tag) @@ -456,9 +451,9 @@ py_dist( limited_api_wheels = { "win32": "310", "win64": "310", - "linux-x86_64": "38", - "linux-aarch_64": "38", - "osx-universal2": "38", + "linux-x86_64": "39", + "linux-aarch_64": "39", + "osx-universal2": "39", }, # LINT.ThenChange(:python_tag) pure_python_wheel = ":pure_python_wheel", diff --git a/python/dist/setup.py b/python/dist/setup.py index 800c651d91..b0ee4c35dd 100755 --- a/python/dist/setup.py +++ b/python/dist/setup.py @@ -53,7 +53,6 @@ setup( classifiers=[ 'Programming Language :: Python', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', @@ -75,5 +74,5 @@ setup( extra_link_args=extra_link_args, ) ], - python_requires='>=3.8', + python_requires='>=3.9', ) diff --git a/python/dist/system_python.bzl b/python/dist/system_python.bzl index 9367dd00fd..76ee09250b 100644 --- a/python/dist/system_python.bzl +++ b/python/dist/system_python.bzl @@ -266,6 +266,6 @@ system_python = repository_rule( implementation = _system_python_impl, local = True, attrs = { - "minimum_python_version": attr.string(default = "3.8"), + "minimum_python_version": attr.string(default = "3.9"), }, ) diff --git a/python/protobuf_distutils/setup.py b/python/protobuf_distutils/setup.py index 3f45f52c0f..818a5eef1c 100644 --- a/python/protobuf_distutils/setup.py +++ b/python/protobuf_distutils/setup.py @@ -30,7 +30,6 @@ setup( # These Python versions should match the protobuf package: 'Programming Language :: Python', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', diff --git a/python/py_extension.bzl b/python/py_extension.bzl index 2741cdf6ec..c68dff4690 100644 --- a/python/py_extension.bzl +++ b/python/py_extension.bzl @@ -28,9 +28,7 @@ def py_extension(name, srcs, copts, deps = [], **kwargs): linkshared = True, linkstatic = True, deps = deps + select({ - "//python:limited_api_3.8": ["@python-3.8.0//:python_headers"], - "//python:full_api_3.8_win32": ["@nuget_python_i686_3.8.0//:python_full_api"], - "//python:full_api_3.8_win64": ["@nuget_python_x86-64_3.8.0//:python_full_api"], + "//python:limited_api_3.9": ["@python-3.9.0//:python_headers"], "//python:full_api_3.9_win32": ["@nuget_python_i686_3.9.0//:python_full_api"], "//python:full_api_3.9_win64": ["@nuget_python_x86-64_3.9.0//:python_full_api"], "//python:limited_api_3.10_win32": ["@nuget_python_i686_3.10.0//:python_limited_api"],