Skip to content

Commit

Permalink
Drop Python 3.8 support
Browse files Browse the repository at this point in the history
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
  • Loading branch information
protobuf-github-bot authored and copybara-github committed Nov 20, 2024
1 parent 3ba0709 commit f5a2937
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 72 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/test_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand All @@ -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
Expand Down
12 changes: 4 additions & 8 deletions .github/workflows/test_upb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ bazel_dep(
register_toolchains("//bazel/private/toolchains:all")

SUPPORTED_PYTHON_VERSIONS = [
"3.8",
"3.9",
"3.10",
"3.11",
Expand Down
14 changes: 3 additions & 11 deletions protobuf_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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"):
Expand Down Expand Up @@ -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",
Expand Down
33 changes: 3 additions & 30 deletions python/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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": [],
}
Expand All @@ -37,45 +37,18 @@ string_flag(
build_setting_default = "system",
values = [
"system",
"38",
"39",
"310",
"311",
],
)

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(
Expand Down
17 changes: 6 additions & 11 deletions python/dist/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}),
Expand All @@ -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",
Expand All @@ -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,
}),
Expand Down Expand Up @@ -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",
Expand All @@ -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/",
Expand Down Expand Up @@ -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)
Expand All @@ -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",
Expand Down
3 changes: 1 addition & 2 deletions python/dist/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ def GetVersion():
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',
Expand All @@ -75,5 +74,5 @@ def GetVersion():
extra_link_args=extra_link_args,
)
],
python_requires='>=3.8',
python_requires='>=3.9',
)
2 changes: 1 addition & 1 deletion python/dist/system_python.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
},
)
1 change: 0 additions & 1 deletion python/protobuf_distutils/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
# 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',
Expand Down
4 changes: 1 addition & 3 deletions python/py_extension.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down

0 comments on commit f5a2937

Please sign in to comment.