Skip to content

Commit bbc9dd9

Browse files
anandoleecopybara-github
authored andcommitted
Drop Python 3.9 support
Python 3.9 reached its official End-of-Life (EOL) on October 31, 2025 https://devguide.python.org/versions/ PiperOrigin-RevId: 854341311
1 parent 0262bd6 commit bbc9dd9

File tree

10 files changed

+26
-107
lines changed

10 files changed

+26
-107
lines changed

.github/workflows/test_python.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
fail-fast: false # Don't cancel all jobs if one fails.
2929
matrix:
3030
type: [ Pure, C++]
31-
version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
31+
version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
3232
include:
3333
- type: Pure
3434
targets: //python/... //python:python_version_test
@@ -37,10 +37,6 @@ jobs:
3737
targets: //python/... //python:python_version_test
3838
flags: --define=use_fast_cpp_protos=true
3939
# Test using WORKSPACE with our oldest support Python version.
40-
- version: "3.9"
41-
nobzlmod: true
42-
# Our 3.9 image has non-hermetic issues and can't be rebuilt. Use the old version.
43-
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/python:7.6.1-3.9-12e21b8dda91028bc14212a3ab582c7c4d149fac
4440
- version: "3.10"
4541
- version: "3.11"
4642
continuous-only: true

.github/workflows/test_upb.yml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -142,25 +142,21 @@ jobs:
142142
# a single wheel. As a result we can just test the oldest and newest
143143
# supported Python versions and assume this gives us sufficient test
144144
# coverage.
145-
- { os: ubuntu-latest, python-version: "3.9", architecture: x64, type: 'binary' }
146-
- { os: macos-14, python-version: "3.9", architecture: arm64, type: 'binary' }
147-
- { os: ubuntu-latest, python-version: "3.13", architecture: x64, type: 'binary' }
148-
- { os: macos-14, python-version: "3.13", architecture: arm64, type: 'binary' }
149-
- { os: ubuntu-latest, python-version: "3.9", architecture: x64, type: 'source'}
150-
- { os: macos-14, python-version: "3.9", architecture: arm64, type: 'source', continuous-only: true }
151-
- { os: ubuntu-latest, python-version: "3.13", architecture: x64, type: 'source'}
152-
- { os: macos-14, python-version: "3.13", architecture: arm64, type: 'source', continuous-only: true }
145+
- { os: ubuntu-latest, python-version: "3.10", architecture: x64, type: 'binary' }
146+
- { os: macos-14, python-version: "3.10", architecture: arm64, type: 'binary' }
147+
- { os: ubuntu-latest, python-version: "3.14", architecture: x64, type: 'binary' }
148+
- { os: macos-14, python-version: "3.14", architecture: arm64, type: 'binary' }
149+
- { os: ubuntu-latest, python-version: "3.10", architecture: x64, type: 'source'}
150+
- { os: macos-14, python-version: "3.10", architecture: arm64, type: 'source', continuous-only: true }
153151
- { os: ubuntu-latest, python-version: "3.14", architecture: x64, type: 'source', continuous-only: true }
154152
- { os: macos-14, python-version: "3.14", architecture: arm64, type: 'source', continuous-only: true }
155153

156154
# Windows uses the full API up until Python 3.10.
157-
- { os: windows-2022, python-version: "3.9", architecture: x86, type: 'binary', continuous-only: true }
158155
- { os: windows-2022, python-version: "3.10", architecture: x86, type: 'binary', continuous-only: true }
159156
- { os: windows-2022, python-version: "3.11", architecture: x86, type: 'binary', continuous-only: true }
160157
- { os: windows-2022, python-version: "3.12", architecture: x86, type: 'binary', continuous-only: true }
161158
- { os: windows-2022, python-version: "3.13", architecture: x86, type: 'binary', continuous-only: true }
162159
- { os: windows-2022, python-version: "3.14", architecture: x86, type: 'binary', continuous-only: true }
163-
- { os: windows-2022, python-version: "3.9", architecture: x64, type: 'binary' }
164160
- { os: windows-2022, python-version: "3.10", architecture: x64, type: 'binary', continuous-only: true }
165161
- { os: windows-2022, python-version: "3.11", architecture: x64, type: 'binary', continuous-only: true }
166162
- { os: windows-2022, python-version: "3.12", architecture: x64, type: 'binary', continuous-only: true }
@@ -237,7 +233,7 @@ jobs:
237233
strategy:
238234
fail-fast: false # Don't cancel all jobs if one fails.
239235
matrix:
240-
python-version: ["3.9", "3.13", "3.14"]
236+
python-version: ["3.10", "3.14"] # oldest + newest versions
241237
runs-on: ubuntu-latest
242238
if: ${{ github.event_name != 'pull_request_target' }}
243239
steps:

MODULE.bazel

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,11 @@ register_toolchains("//bazel/private/toolchains/prebuilt:all")
139139
register_toolchains("//bazel/private/toolchains:all")
140140

141141
SUPPORTED_PYTHON_VERSIONS = [
142-
"3.9",
143142
"3.10",
144143
"3.11",
145144
"3.12",
146145
"3.13",
146+
"3.14",
147147
]
148148

149149
# TODO: Replace system_python with hermetic_python.
@@ -331,18 +331,8 @@ archive_override(
331331
# Python headers for release
332332
python_headers = use_extension("//python/dist:python_downloads.bzl", "python_headers", dev_dependency = True)
333333
python_headers.source_archive(
334-
sha256 = "df796b2dc8ef085edae2597a41c1c0a63625ebd92487adaef2fed22b567873e8",
335-
version = "3.9.0",
336-
)
337-
python_headers.nuget_package(
338-
cpu = "i686",
339-
sha256 = "229abecbe49dc08fe5709e0b31e70edfb3b88f23335ebfc2904c44f940fd59b6",
340-
version = "3.9.0",
341-
)
342-
python_headers.nuget_package(
343-
cpu = "x86-64",
344-
sha256 = "6af58a733e7dfbfcdd50d55788134393d6ffe7ab8270effbf724bdb786558832",
345-
version = "3.9.0",
334+
sha256 = "c4e0cbad57c90690cb813fb4663ef670b4d0f587d8171e2c42bd4c9245bd2758",
335+
version = "3.10.0",
346336
)
347337
python_headers.nuget_package(
348338
cpu = "i686",
@@ -357,8 +347,6 @@ python_headers.nuget_package(
357347
use_repo(
358348
python_headers,
359349
"nuget_python_i686_3.10.0",
360-
"nuget_python_i686_3.9.0",
361350
"nuget_python_x86-64_3.10.0",
362-
"nuget_python_x86-64_3.9.0",
363-
"python-3.9.0",
351+
"python-3.10.0",
364352
)

protobuf_deps.bzl

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def protobuf_deps():
150150
if not native.existing_rule("system_python"):
151151
system_python(
152152
name = "system_python",
153-
minimum_python_version = "3.9",
153+
minimum_python_version = "3.10",
154154
)
155155

156156
if not native.existing_rule("rules_jvm_external"):
@@ -204,18 +204,8 @@ def protobuf_deps():
204204

205205
# Python Downloads
206206
python_source_archive(
207-
version = "3.9.0",
208-
sha256 = "df796b2dc8ef085edae2597a41c1c0a63625ebd92487adaef2fed22b567873e8",
209-
)
210-
python_nuget_package(
211-
version = "3.9.0",
212-
cpu = "i686",
213-
sha256 = "229abecbe49dc08fe5709e0b31e70edfb3b88f23335ebfc2904c44f940fd59b6",
214-
)
215-
python_nuget_package(
216-
version = "3.9.0",
217-
cpu = "x86-64",
218-
sha256 = "6af58a733e7dfbfcdd50d55788134393d6ffe7ab8270effbf724bdb786558832",
207+
version = "3.10.0",
208+
sha256 = "c4e0cbad57c90690cb813fb4663ef670b4d0f587d8171e2c42bd4c9245bd2758",
219209
)
220210
python_nuget_package(
221211
version = "3.10.0",

python/BUILD.bazel

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
# license that can be found in the LICENSE file or at
66
# https://developers.google.com/open-source/licenses/bsd
77

8-
load("@bazel_skylib//lib:selects.bzl", "selects")
98
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag", "string_flag")
109
load("//python:build_targets.bzl", "build_targets")
1110
load("//python:py_extension.bzl", "py_extension")
@@ -21,7 +20,6 @@ package(
2120
)
2221

2322
LIMITED_API_FLAG_SELECT = {
24-
":limited_api_3.9": ["-DPy_LIMITED_API=0x03090000"],
2523
":limited_api_3.10": ["-DPy_LIMITED_API=0x030a0000"],
2624
"//conditions:default": [],
2725
}
@@ -43,37 +41,11 @@ string_flag(
4341
)
4442

4543
config_setting(
46-
name = "limited_api_3.9",
44+
name = "limited_api_3.10",
4745
flag_values = {
4846
":limited_api": "True",
49-
":python_version": "39",
50-
},
51-
)
52-
53-
config_setting(
54-
name = "full_api_3.9_win32",
55-
flag_values = {
56-
":limited_api": "False",
57-
":python_version": "39",
58-
},
59-
values = {"cpu": "win32"},
60-
)
61-
62-
config_setting(
63-
name = "full_api_3.9_win64",
64-
flag_values = {
65-
":limited_api": "False",
66-
":python_version": "39",
47+
":python_version": "310",
6748
},
68-
values = {"cpu": "win64"},
69-
)
70-
71-
selects.config_setting_group(
72-
name = "full_api_3.9",
73-
match_any = [
74-
"full_api_3.9_win32",
75-
":full_api_3.9_win64",
76-
],
7749
)
7850

7951
config_setting(
@@ -94,14 +66,6 @@ config_setting(
9466
values = {"cpu": "win64"},
9567
)
9668

97-
selects.config_setting_group(
98-
name = "limited_api_3.10",
99-
match_any = [
100-
":limited_api_3.10_win32",
101-
":limited_api_3.10_win64",
102-
],
103-
)
104-
10569
_message_target_compatible_with = {
10670
"@platforms//os:windows": ["@platforms//:incompatible"],
10771
"@system_python//:none": ["@platforms//:incompatible"],

python/dist/BUILD.bazel

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -328,15 +328,13 @@ genrule(
328328
py_wheel(
329329
name = "binary_wheel",
330330
abi = select({
331-
"//python:full_api_3.9": "cp39",
332331
"//conditions:default": "abi3",
333332
}),
334333
author = "[email protected]",
335334
author_email = "[email protected]",
336335
classifiers = [
337336
"Programming Language :: Python",
338337
"Programming Language :: Python :: 3",
339-
"Programming Language :: Python :: 3.9",
340338
"Programming Language :: Python :: 3.10",
341339
"Programming Language :: Python :: 3.11",
342340
"Programming Language :: Python :: 3.12",
@@ -362,15 +360,13 @@ py_wheel(
362360
":windows_x86_64": "win_amd64",
363361
"//conditions:default": "any",
364362
}),
365-
python_requires = ">=3.9",
363+
python_requires = ">=3.10",
366364
# LINT.IfChange(python_tag)
367365
python_tag = selects.with_or({
368-
("//python:limited_api_3.9", "//python:full_api_3.9"): "cp39",
369366
"//python:limited_api_3.10": "cp310",
370367
"//conditions:default": "cp" + SYSTEM_PYTHON_VERSION,
371368
}),
372369
# LINT.ThenChange(
373-
# :full_api_version,
374370
# :limited_api_wheels,
375371
# )
376372
strip_path_prefixes = [
@@ -399,7 +395,6 @@ py_wheel(
399395
classifiers = [
400396
"Programming Language :: Python",
401397
"Programming Language :: Python :: 3",
402-
"Programming Language :: Python :: 3.9",
403398
"Programming Language :: Python :: 3.10",
404399
"Programming Language :: Python :: 3.11",
405400
"Programming Language :: Python :: 3.12",
@@ -413,7 +408,7 @@ py_wheel(
413408
homepage = "https://developers.google.com/protocol-buffers/",
414409
license = "3-Clause BSD License",
415410
platform = "any",
416-
python_requires = ">=3.9",
411+
python_requires = ">=3.10",
417412
python_tag = "py3",
418413
strip_path_prefixes = [
419414
"python/",
@@ -466,12 +461,6 @@ py_dist(
466461
"win32",
467462
"win64",
468463
],
469-
# Windows needs version-specific wheels until 3.10.
470-
# LINT.IfChange(full_api_version)
471-
full_api_versions = [
472-
"39",
473-
],
474-
# LINT.ThenChange(:python_tag)
475464
# Limited API: these wheels will satisfy any Python version >= the
476465
# given version.
477466
#
@@ -482,10 +471,10 @@ py_dist(
482471
limited_api_wheels = {
483472
"win32": "310",
484473
"win64": "310",
485-
"linux-x86_64": "39",
486-
"linux-aarch_64": "39",
487-
"linux-s390_64": "39",
488-
"osx-universal2": "39",
474+
"linux-x86_64": "310",
475+
"linux-aarch_64": "310",
476+
"linux-s390_64": "310",
477+
"osx-universal2": "310",
489478
},
490479
# LINT.ThenChange(:python_tag)
491480
pure_python_wheel = ":pure_python_wheel",

python/dist/setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ def GetVersion():
7171
classifiers=[
7272
'Programming Language :: Python',
7373
'Programming Language :: Python :: 3',
74-
'Programming Language :: Python :: 3.9',
7574
'Programming Language :: Python :: 3.10',
7675
'Programming Language :: Python :: 3.11',
7776
'Programming Language :: Python :: 3.12',
@@ -89,5 +88,5 @@ def GetVersion():
8988
extra_link_args=extra_link_args,
9089
)
9190
],
92-
python_requires='>=3.9',
91+
python_requires='>=3.10',
9392
)

python/dist/system_python.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ system_python = repository_rule(
268268
implementation = _system_python_impl,
269269
local = True,
270270
attrs = {
271-
"minimum_python_version": attr.string(default = "3.9"),
271+
"minimum_python_version": attr.string(default = "3.10"),
272272
},
273273
)
274274

python/protobuf_distutils/setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
# These Python versions should match the protobuf package:
3131
'Programming Language :: Python',
3232
'Programming Language :: Python :: 3',
33-
'Programming Language :: Python :: 3.9',
3433
'Programming Language :: Python :: 3.10',
3534
'Programming Language :: Python :: 3.11',
3635
'Programming Language :: Python :: 3.12',

python/py_extension.bzl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ def py_extension(name, srcs, copts, deps = [], **kwargs):
2828
linkshared = True,
2929
linkstatic = True,
3030
deps = deps + select({
31-
"//python:limited_api_3.9": ["@python-3.9.0//:python_headers"],
32-
"//python:full_api_3.9_win32": ["@nuget_python_i686_3.9.0//:python_full_api"],
33-
"//python:full_api_3.9_win64": ["@nuget_python_x86-64_3.9.0//:python_full_api"],
31+
"//python:limited_api_3.10": ["@python-3.10.0//:python_headers"],
3432
"//python:limited_api_3.10_win32": ["@nuget_python_i686_3.10.0//:python_limited_api"],
3533
"//python:limited_api_3.10_win64": ["@nuget_python_x86-64_3.10.0//:python_limited_api"],
3634
"//conditions:default": ["@system_python//:python_headers"],

0 commit comments

Comments
 (0)