From b3ad5d17d4236363cd94ac7e1067e47874fef699 Mon Sep 17 00:00:00 2001 From: Sreenithi Sridharan <19sreenithi98@gmail.com> Date: Wed, 25 Sep 2024 20:11:10 -0700 Subject: [PATCH] Add templating and support for Python 3.13 (#37643) This PR adds templating for Python versions and updates the maximum supported Python version to 3.13. The following major changes related to templating are added: - Minimum supported Python version and list of supported versions in `setup.py` are fetched using new template generated files called `python_version.py` - Dockerfiles for the different Python Linux builds are now template generated. - The "Supported Python Versions" section from READMEs of ancillary and main packages have been removed Note: All the `python_version.py` files and Linux build `Dockerfiles` except `tools/dockerfile/grpc_artifact_python_linux_armv7/Dockerfile` in the PR are generated from the respective templates. Further non-templated additions to add support for Python 3.13: - install scripts and artifacts for windows, macos and linux are added manually. Later, these can be templated as well. - updated cython bounds to 3.x - updated twine version to solve [cgi module import error](https://github.com/pypa/twine/issues/1046) - the twine update introduces a dependency on cryptography>=2.0. But the cryptography package doesn't support 32-bit Linux images and hence `twine check` has been disabled for x86 manylinux and x86 musllinux artifacts. Closes #37643 PiperOrigin-RevId: 678954495 --- PYTHON-MANIFEST.in | 1 + WORKSPACE | 2 +- bazel/grpc_python_deps.bzl | 6 +- black.toml | 1 + build_handwritten.yaml | 7 +++ setup.py | 27 +++++---- src/python/grpcio/README.rst | 3 - src/python/grpcio/python_version.py | 20 +++++++ src/python/grpcio_admin/MANIFEST.in | 1 + src/python/grpcio_admin/python_version.py | 20 +++++++ src/python/grpcio_admin/setup.py | 5 +- src/python/grpcio_channelz/MANIFEST.in | 1 + src/python/grpcio_channelz/README.rst | 3 - src/python/grpcio_channelz/grpc_version.py | 2 +- src/python/grpcio_channelz/python_version.py | 20 +++++++ src/python/grpcio_channelz/setup.py | 29 ++++++---- src/python/grpcio_csds/MANIFEST.in | 1 + src/python/grpcio_csds/python_version.py | 20 +++++++ src/python/grpcio_csds/setup.py | 4 +- .../grpcio_csm_observability/MANIFEST.in | 1 + .../grpcio_csm_observability/README.rst | 3 - .../python_version.py | 20 +++++++ src/python/grpcio_csm_observability/setup.py | 4 +- src/python/grpcio_health_checking/MANIFEST.in | 1 + src/python/grpcio_health_checking/README.rst | 3 - .../grpcio_health_checking/python_version.py | 20 +++++++ src/python/grpcio_health_checking/setup.py | 27 +++++---- src/python/grpcio_observability/MANIFEST.in | 1 + src/python/grpcio_observability/README.rst | 3 - .../grpcio_observability/python_version.py | 20 +++++++ src/python/grpcio_observability/setup.py | 3 +- src/python/grpcio_reflection/MANIFEST.in | 1 + src/python/grpcio_reflection/README.rst | 3 - .../grpcio_reflection/python_version.py | 20 +++++++ src/python/grpcio_reflection/setup.py | 27 +++++---- src/python/grpcio_status/MANIFEST.in | 1 + src/python/grpcio_status/README.rst | 3 - src/python/grpcio_status/python_version.py | 20 +++++++ src/python/grpcio_status/setup.py | 27 +++++---- src/python/grpcio_testing/README.rst | 3 - .../python/grpcio/python_version.py.template | 22 +++++++ .../grpcio_admin/python_version.py.template | 22 +++++++ .../grpcio_channelz/grpc_version.py.template | 2 +- .../python_version.py.template | 22 +++++++ .../grpcio_csds/python_version.py.template | 22 +++++++ .../python_version.py.template | 22 +++++++ .../python_version.py.template | 22 +++++++ .../python_version.py.template | 22 +++++++ .../python_version.py.template | 22 +++++++ .../grpcio_status/python_version.py.template | 22 +++++++ .../distrib/python/grpc_version.py.template | 2 +- .../grpc_tools/python_version.py.template | 22 +++++++ .../grpcio_tools/python_version.py.template | 22 +++++++ .../xds_protos/grpc_version.py.template | 2 +- .../xds_protos/python_version.py.template | 22 +++++++ .../dockerfile/ccache_crosscompile.include | 14 +++++ .../dockerfile/compile_python_313.include | 21 +++++++ templates/tools/dockerfile/git_config.include | 22 +++++++ .../Dockerfile.template | 57 +++++++++++++++++++ .../Dockerfile.template | 28 +++++++++ .../Dockerfile.template | 33 +++++++++++ .../Dockerfile.template | 34 +++++++++++ .../Dockerfile.template | 27 +++++++++ .../Dockerfile.template | 25 ++++++++ .../dockerfile/python_pip_builds.include | 8 +++ .../Dockerfile.template | 1 + test/distrib/bazel/python/WORKSPACE | 2 +- .../dockerimage_current_versions.bzl | 14 ++--- tools/bazelify_tests/test/BUILD | 8 +-- ... build_artifact_python_linux_x64_cp313.sh} | 4 +- .../expand_supported_python_versions.py | 33 +++++++++++ tools/distrib/install_all_python_modules.sh | 1 - tools/distrib/python/grpc_version.py | 2 +- tools/distrib/python/grpcio_tools/MANIFEST.in | 2 + .../grpcio_tools/grpc_tools/python_version.py | 20 +++++++ .../python/grpcio_tools/python_version.py | 20 +++++++ tools/distrib/python/grpcio_tools/setup.py | 3 +- tools/distrib/python/xds_protos/MANIFEST.in | 1 + .../distrib/python/xds_protos/grpc_version.py | 2 +- .../python/xds_protos/python_version.py | 20 +++++++ tools/distrib/python/xds_protos/setup.py | 4 +- tools/dockerfile/README.md | 4 ++ ...rtifact_python_linux_armv7.current_version | 2 +- .../Dockerfile | 40 ++++++++++--- ...stall_python_for_wheel_crosscompilation.sh | 2 +- ...thon_manylinux2014_aarch64.current_version | 2 +- .../Dockerfile | 50 +++++++++++----- ...t_python_manylinux2014_x64.current_version | 2 +- .../Dockerfile | 48 +++++++++++----- ...t_python_manylinux2014_x86.current_version | 2 +- .../Dockerfile | 48 +++++++++++----- ...t_python_musllinux_1_1_x64.current_version | 2 +- .../Dockerfile | 52 ++++++++++++----- ...t_python_musllinux_1_1_x86.current_version | 2 +- .../Dockerfile | 50 +++++++++++----- ...ython_debian11_default_x64.current_version | 2 +- .../python_debian11_default_x64/Dockerfile | 22 +++++++ .../install_python_interpreters.ps1 | 17 ++++++ .../helper_scripts/prepare_build_macos_rc | 8 +++ .../helper_scripts/requirements.macos.txt | 2 +- .../macos/grpc_distribtests_python.sh | 12 ++-- tools/run_tests/artifacts/artifact_targets.py | 32 ++++++++--- .../artifacts/build_artifact_python.bat | 2 +- .../artifacts/build_artifact_python.sh | 5 +- tools/run_tests/run_tests.py | 10 ++++ 105 files changed, 1260 insertions(+), 218 deletions(-) create mode 100644 src/python/grpcio/python_version.py create mode 100644 src/python/grpcio_admin/python_version.py create mode 100644 src/python/grpcio_channelz/python_version.py create mode 100644 src/python/grpcio_csds/python_version.py create mode 100644 src/python/grpcio_csm_observability/python_version.py create mode 100644 src/python/grpcio_health_checking/python_version.py create mode 100644 src/python/grpcio_observability/python_version.py create mode 100644 src/python/grpcio_reflection/python_version.py create mode 100644 src/python/grpcio_status/python_version.py create mode 100644 templates/src/python/grpcio/python_version.py.template create mode 100644 templates/src/python/grpcio_admin/python_version.py.template create mode 100644 templates/src/python/grpcio_channelz/python_version.py.template create mode 100644 templates/src/python/grpcio_csds/python_version.py.template create mode 100644 templates/src/python/grpcio_csm_observability/python_version.py.template create mode 100644 templates/src/python/grpcio_health_checking/python_version.py.template create mode 100644 templates/src/python/grpcio_observability/python_version.py.template create mode 100644 templates/src/python/grpcio_reflection/python_version.py.template create mode 100644 templates/src/python/grpcio_status/python_version.py.template create mode 100644 templates/tools/distrib/python/grpcio_tools/grpc_tools/python_version.py.template create mode 100644 templates/tools/distrib/python/grpcio_tools/python_version.py.template create mode 100644 templates/tools/distrib/python/xds_protos/python_version.py.template create mode 100644 templates/tools/dockerfile/ccache_crosscompile.include create mode 100644 templates/tools/dockerfile/compile_python_313.include create mode 100644 templates/tools/dockerfile/git_config.include create mode 100644 templates/tools/dockerfile/grpc_artifact_python_linux_armv7/Dockerfile.template create mode 100644 templates/tools/dockerfile/grpc_artifact_python_manylinux2014_aarch64/Dockerfile.template create mode 100644 templates/tools/dockerfile/grpc_artifact_python_manylinux2014_x64/Dockerfile.template create mode 100644 templates/tools/dockerfile/grpc_artifact_python_manylinux2014_x86/Dockerfile.template create mode 100644 templates/tools/dockerfile/grpc_artifact_python_musllinux_1_1_x64/Dockerfile.template create mode 100644 templates/tools/dockerfile/grpc_artifact_python_musllinux_1_1_x86/Dockerfile.template create mode 100644 templates/tools/dockerfile/python_pip_builds.include rename tools/bazelify_tests/test/{build_artifact_python_linux_x64_cp312.sh => build_artifact_python_linux_x64_cp313.sh} (93%) create mode 100644 tools/buildgen/plugins/expand_supported_python_versions.py create mode 100644 tools/distrib/python/grpcio_tools/grpc_tools/python_version.py create mode 100644 tools/distrib/python/grpcio_tools/python_version.py create mode 100644 tools/distrib/python/xds_protos/python_version.py diff --git a/PYTHON-MANIFEST.in b/PYTHON-MANIFEST.in index dd76dbcf7568a2..b8ab04726ed9b2 100644 --- a/PYTHON-MANIFEST.in +++ b/PYTHON-MANIFEST.in @@ -17,6 +17,7 @@ include src/python/grpcio/_parallel_compile_patch.py include src/python/grpcio/_spawn_patch.py include src/python/grpcio/commands.py include src/python/grpcio/grpc_version.py +include src/python/grpcio/python_version.py include src/python/grpcio/grpc_core_dependencies.py include src/python/grpcio/precompiled.py include src/python/grpcio/support.py diff --git a/WORKSPACE b/WORKSPACE index f88a7790594cc0..675233b2eb1ace 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -89,7 +89,7 @@ load("@com_google_protobuf//bazel:system_python.bzl", "system_python") system_python( name = "system_python", - minimum_python_version = "3.7", + minimum_python_version = "3.8", ) load("@system_python//:pip.bzl", system_pip_parse = "pip_parse") diff --git a/bazel/grpc_python_deps.bzl b/bazel/grpc_python_deps.bzl index dbfff526a11140..44eca11f6719bd 100644 --- a/bazel/grpc_python_deps.bzl +++ b/bazel/grpc_python_deps.bzl @@ -38,9 +38,9 @@ def grpc_python_deps(): http_archive( name = "cython", build_file = "@com_github_grpc_grpc//third_party:cython.BUILD", - sha256 = "a2da56cc22be823acf49741b9aa3aa116d4f07fa8e8b35a3cb08b8447b37c607", - strip_prefix = "cython-0.29.35", + sha256 = "2ec7d66d23d6da2328fb24f5c1bec6c63a59ec2e91027766ab904f417e1078aa", + strip_prefix = "cython-3.0.11", urls = [ - "https://github.com/cython/cython/archive/0.29.35.tar.gz", + "https://github.com/cython/cython/archive/3.0.11.tar.gz", ], ) diff --git a/black.toml b/black.toml index e655f7f8e7e805..1a397fea579986 100644 --- a/black.toml +++ b/black.toml @@ -15,6 +15,7 @@ extend-exclude = ''' | test/cpp/naming/resolver_component_tests_runner.py # AUTO-GENERATED # AUTO-GENERATED from a template: | grpc_version.py + | python_version.py | src/python/grpcio/grpc_core_dependencies.py | src/python/grpcio/grpc/_grpcio_metadata.py # AUTO-GENERATED BY make_grpcio_tools.py diff --git a/build_handwritten.yaml b/build_handwritten.yaml index 61e73166122867..3c0d694d77cf99 100644 --- a/build_handwritten.yaml +++ b/build_handwritten.yaml @@ -16,6 +16,13 @@ settings: csharp_major_version: 2 g_stands_for: groovy protobuf_version: 3.28.1 + supported_python_versions: + - '3.8' + - '3.9' + - '3.10' + - '3.11' + - '3.12' + - '3.13' version: 1.68.0-dev configs: asan: diff --git a/setup.py b/setup.py index b93637215ff479..48bfefe4dbac72 100644 --- a/setup.py +++ b/setup.py @@ -88,6 +88,7 @@ import _parallel_compile_patch import _spawn_patch import grpc_core_dependencies +import python_version import commands import grpc_version @@ -95,19 +96,21 @@ _parallel_compile_patch.monkeypatch_compile_maybe() _spawn_patch.monkeypatch_spawn() + LICENSE = "Apache License 2.0" -CLASSIFIERS = [ - "Development Status :: 5 - Production/Stable", - "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", - "Programming Language :: Python :: 3.12", - "License :: OSI Approved :: Apache Software License", -] +CLASSIFIERS = ( + [ + "Development Status :: 5 - Production/Stable", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + ] + + [ + f"Programming Language :: Python :: {x}" + for x in python_version.SUPPORTED_PYTHON_VERSIONS + ] + + ["License :: OSI Approved :: Apache Software License"] +) def _env_bool_value(env_name, default): @@ -596,7 +599,7 @@ def cython_extensions_and_necessity(): packages=list(PACKAGES), package_dir=PACKAGE_DIRECTORIES, package_data=PACKAGE_DATA, - python_requires=">=3.8", + python_requires=f">={python_version.MIN_PYTHON_VERSION}", install_requires=INSTALL_REQUIRES, extras_require=EXTRAS_REQUIRES, setup_requires=SETUP_REQUIRES, diff --git a/src/python/grpcio/README.rst b/src/python/grpcio/README.rst index eb2e8a9aa59907..cd529ad54f74db 100644 --- a/src/python/grpcio/README.rst +++ b/src/python/grpcio/README.rst @@ -8,9 +8,6 @@ Package for gRPC Python. .. |compat_check_pypi| image:: https://python-compatibility-tools.appspot.com/one_badge_image?package=grpcio :target: https://python-compatibility-tools.appspot.com/one_badge_target?package=grpcio -Supported Python Versions -------------------------- -Python >= 3.8 Installation ------------ diff --git a/src/python/grpcio/python_version.py b/src/python/grpcio/python_version.py new file mode 100644 index 00000000000000..4faab63465c01c --- /dev/null +++ b/src/python/grpcio/python_version.py @@ -0,0 +1,20 @@ +# Copyright 2024 gRPC authors. +# +# 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. + +# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/python_version.py.template`!!! + +SUPPORTED_PYTHON_VERSIONS = ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] + +MIN_PYTHON_VERSION = 3.8 +MAX_PYTHON_VERSION = 3.13 diff --git a/src/python/grpcio_admin/MANIFEST.in b/src/python/grpcio_admin/MANIFEST.in index eb7e029a4ba629..3cb626587701ab 100644 --- a/src/python/grpcio_admin/MANIFEST.in +++ b/src/python/grpcio_admin/MANIFEST.in @@ -1,4 +1,5 @@ include grpc_version.py +include python_version.py recursive-include grpc_admin *.py global-exclude *.pyc include LICENSE diff --git a/src/python/grpcio_admin/python_version.py b/src/python/grpcio_admin/python_version.py new file mode 100644 index 00000000000000..d47284cb06f3ae --- /dev/null +++ b/src/python/grpcio_admin/python_version.py @@ -0,0 +1,20 @@ +# Copyright 2024 gRPC authors. +# +# 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. + +# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_admin/python_version.py.template`!!! + +SUPPORTED_PYTHON_VERSIONS = ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] + +MIN_PYTHON_VERSION = 3.8 +MAX_PYTHON_VERSION = 3.13 diff --git a/src/python/grpcio_admin/setup.py b/src/python/grpcio_admin/setup.py index 4e6bdbc8dd5b1c..30d0ca62a143f5 100644 --- a/src/python/grpcio_admin/setup.py +++ b/src/python/grpcio_admin/setup.py @@ -25,6 +25,8 @@ os.chdir(os.path.dirname(os.path.abspath(__file__))) # Break import-style to ensure we can actually find our local modules. +import python_version + import grpc_version CLASSIFIERS = [ @@ -44,6 +46,7 @@ ) SETUP_REQUIRES = INSTALL_REQUIRES + setuptools.setup( name="grpcio-admin", version=grpc_version.VERSION, @@ -56,7 +59,7 @@ url="https://grpc.io", package_dir=PACKAGE_DIRECTORIES, packages=setuptools.find_packages("."), - python_requires=">=3.8", + python_requires=f">={python_version.MIN_PYTHON_VERSION}", install_requires=INSTALL_REQUIRES, setup_requires=SETUP_REQUIRES, ) diff --git a/src/python/grpcio_channelz/MANIFEST.in b/src/python/grpcio_channelz/MANIFEST.in index 7354bef4235b76..14089064dce6be 100644 --- a/src/python/grpcio_channelz/MANIFEST.in +++ b/src/python/grpcio_channelz/MANIFEST.in @@ -1,4 +1,5 @@ include grpc_version.py +include python_version.py recursive-include grpc_channelz *.py *.pyi global-exclude *.pyc include LICENSE diff --git a/src/python/grpcio_channelz/README.rst b/src/python/grpcio_channelz/README.rst index 027c0d9e10c78a..260564221435c0 100644 --- a/src/python/grpcio_channelz/README.rst +++ b/src/python/grpcio_channelz/README.rst @@ -3,9 +3,6 @@ gRPC Python Channelz package Channelz is a live debug tool in gRPC Python. -Supported Python Versions -------------------------- -Python >= 3.8 Dependencies ------------ diff --git a/src/python/grpcio_channelz/grpc_version.py b/src/python/grpcio_channelz/grpc_version.py index de5e63dddcf2b0..fff1849540e4fb 100644 --- a/src/python/grpcio_channelz/grpc_version.py +++ b/src/python/grpcio_channelz/grpc_version.py @@ -12,6 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_channelz/grpc_version.py.template`!!! +# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_channelz/python_version.py.template`!!! VERSION = '1.68.0.dev0' diff --git a/src/python/grpcio_channelz/python_version.py b/src/python/grpcio_channelz/python_version.py new file mode 100644 index 00000000000000..74755fdb1a983f --- /dev/null +++ b/src/python/grpcio_channelz/python_version.py @@ -0,0 +1,20 @@ +# Copyright 2024 gRPC authors. +# +# 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. + +# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_channelz/python_version.py.template`!!! + +SUPPORTED_PYTHON_VERSIONS = ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] + +MIN_PYTHON_VERSION = 3.8 +MAX_PYTHON_VERSION = 3.13 diff --git a/src/python/grpcio_channelz/setup.py b/src/python/grpcio_channelz/setup.py index 034ed814829a26..222a0d30ca3522 100644 --- a/src/python/grpcio_channelz/setup.py +++ b/src/python/grpcio_channelz/setup.py @@ -25,6 +25,8 @@ os.chdir(os.path.dirname(os.path.abspath(__file__))) # Break import-style to ensure we can actually find our local modules. +import python_version + import grpc_version @@ -44,17 +46,19 @@ def run(self): pass -CLASSIFIERS = [ - "Development Status :: 5 - Production/Stable", - "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", - "Programming Language :: Python :: 3.12", - "License :: OSI Approved :: Apache Software License", -] +CLASSIFIERS = ( + [ + "Development Status :: 5 - Production/Stable", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + ] + + [ + f"Programming Language :: Python :: {x}" + for x in python_version.SUPPORTED_PYTHON_VERSIONS + ] + + ["License :: OSI Approved :: Apache Software License"] +) + PACKAGE_DIRECTORIES = { "": ".", @@ -85,6 +89,7 @@ def run(self): "build_package_protos": _NoOpCommand, } + setuptools.setup( name="grpcio-channelz", version=grpc_version.VERSION, @@ -97,7 +102,7 @@ def run(self): url="https://grpc.io", package_dir=PACKAGE_DIRECTORIES, packages=setuptools.find_packages("."), - python_requires=">=3.8", + python_requires=f">={python_version.MIN_PYTHON_VERSION}", install_requires=INSTALL_REQUIRES, setup_requires=SETUP_REQUIRES, cmdclass=COMMAND_CLASS, diff --git a/src/python/grpcio_csds/MANIFEST.in b/src/python/grpcio_csds/MANIFEST.in index 4ecdf7428ed0c2..3df9cc3cac29b6 100644 --- a/src/python/grpcio_csds/MANIFEST.in +++ b/src/python/grpcio_csds/MANIFEST.in @@ -1,4 +1,5 @@ include grpc_version.py +include python_version.py recursive-include grpc_csds *.py global-exclude *.pyc include LICENSE diff --git a/src/python/grpcio_csds/python_version.py b/src/python/grpcio_csds/python_version.py new file mode 100644 index 00000000000000..5d9e6b076eab11 --- /dev/null +++ b/src/python/grpcio_csds/python_version.py @@ -0,0 +1,20 @@ +# Copyright 2024 gRPC authors. +# +# 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. + +# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_csds/python_version.py.template`!!! + +SUPPORTED_PYTHON_VERSIONS = ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] + +MIN_PYTHON_VERSION = 3.8 +MAX_PYTHON_VERSION = 3.13 diff --git a/src/python/grpcio_csds/setup.py b/src/python/grpcio_csds/setup.py index 8fb4dab5341ec2..1dc40333f039f1 100644 --- a/src/python/grpcio_csds/setup.py +++ b/src/python/grpcio_csds/setup.py @@ -25,6 +25,8 @@ os.chdir(os.path.dirname(os.path.abspath(__file__))) # Break import-style to ensure we can actually find our local modules. +import python_version + import grpc_version CLASSIFIERS = [ @@ -57,7 +59,7 @@ url="https://grpc.io", package_dir=PACKAGE_DIRECTORIES, packages=setuptools.find_packages("."), - python_requires=">=3.8", + python_requires=f">={python_version.MIN_PYTHON_VERSION}", install_requires=INSTALL_REQUIRES, setup_requires=SETUP_REQUIRES, ) diff --git a/src/python/grpcio_csm_observability/MANIFEST.in b/src/python/grpcio_csm_observability/MANIFEST.in index 754eb1d7e130fb..afaf346488306b 100644 --- a/src/python/grpcio_csm_observability/MANIFEST.in +++ b/src/python/grpcio_csm_observability/MANIFEST.in @@ -1,4 +1,5 @@ graft src/python/grpcio_csm_observability/grpc_csm_observability.egg-info graft grpc_csm_observability include grpc_version.py +include python_version.py include README.rst diff --git a/src/python/grpcio_csm_observability/README.rst b/src/python/grpcio_csm_observability/README.rst index f2c549afdb189e..4725f758140eec 100644 --- a/src/python/grpcio_csm_observability/README.rst +++ b/src/python/grpcio_csm_observability/README.rst @@ -3,9 +3,6 @@ gRPC Python CSM Observability Package for gRPC Python CSM Observability. -Supported Python Versions -------------------------- -Python >= 3.8 Installation ------------ diff --git a/src/python/grpcio_csm_observability/python_version.py b/src/python/grpcio_csm_observability/python_version.py new file mode 100644 index 00000000000000..4309c6a3ce0fa5 --- /dev/null +++ b/src/python/grpcio_csm_observability/python_version.py @@ -0,0 +1,20 @@ +# Copyright 2024 gRPC authors. +# +# 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. + +# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_csm_observability/python_version.py.template`!!! + +SUPPORTED_PYTHON_VERSIONS = ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] + +MIN_PYTHON_VERSION = 3.8 +MAX_PYTHON_VERSION = 3.13 diff --git a/src/python/grpcio_csm_observability/setup.py b/src/python/grpcio_csm_observability/setup.py index c9a26db1ed5d08..ce4ec398a1d30e 100644 --- a/src/python/grpcio_csm_observability/setup.py +++ b/src/python/grpcio_csm_observability/setup.py @@ -22,6 +22,8 @@ # Ensure we're in the proper directory whether or not we're being used by pip. os.chdir(os.path.dirname(os.path.abspath(__file__))) +import python_version + import grpc_version CLASSIFIERS = [ @@ -58,6 +60,6 @@ classifiers=CLASSIFIERS, package_dir=PACKAGE_DIRECTORIES, packages=setuptools.find_packages("."), - python_requires=">=3.8", + python_requires=f">={python_version.MIN_PYTHON_VERSION}", install_requires=INSTALL_REQUIRES, ) diff --git a/src/python/grpcio_health_checking/MANIFEST.in b/src/python/grpcio_health_checking/MANIFEST.in index 6644074dc22f3e..f68d10ad183024 100644 --- a/src/python/grpcio_health_checking/MANIFEST.in +++ b/src/python/grpcio_health_checking/MANIFEST.in @@ -1,4 +1,5 @@ include grpc_version.py +include python_version.py recursive-include grpc_health *.py *.pyi global-exclude *.pyc include LICENSE diff --git a/src/python/grpcio_health_checking/README.rst b/src/python/grpcio_health_checking/README.rst index d13e671eae461c..388fe3148fef38 100644 --- a/src/python/grpcio_health_checking/README.rst +++ b/src/python/grpcio_health_checking/README.rst @@ -3,9 +3,6 @@ gRPC Python Health Checking Reference package for GRPC Python health checking. -Supported Python Versions -------------------------- -Python >= 3.8 Dependencies ------------ diff --git a/src/python/grpcio_health_checking/python_version.py b/src/python/grpcio_health_checking/python_version.py new file mode 100644 index 00000000000000..96e4e2f0e06c27 --- /dev/null +++ b/src/python/grpcio_health_checking/python_version.py @@ -0,0 +1,20 @@ +# Copyright 2024 gRPC authors. +# +# 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. + +# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_health_checking/python_version.py.template`!!! + +SUPPORTED_PYTHON_VERSIONS = ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] + +MIN_PYTHON_VERSION = 3.8 +MAX_PYTHON_VERSION = 3.13 diff --git a/src/python/grpcio_health_checking/setup.py b/src/python/grpcio_health_checking/setup.py index 97a407230976fe..7d451e63ee6fff 100644 --- a/src/python/grpcio_health_checking/setup.py +++ b/src/python/grpcio_health_checking/setup.py @@ -24,6 +24,8 @@ os.chdir(os.path.dirname(os.path.abspath(__file__))) # Break import-style to ensure we can actually find our local modules. +import python_version + import grpc_version @@ -43,17 +45,18 @@ def run(self): pass -CLASSIFIERS = [ - "Development Status :: 5 - Production/Stable", - "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", - "Programming Language :: Python :: 3.12", - "License :: OSI Approved :: Apache Software License", -] +CLASSIFIERS = ( + [ + "Development Status :: 5 - Production/Stable", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + ] + + [ + f"Programming Language :: Python :: {x}" + for x in python_version.SUPPORTED_PYTHON_VERSIONS + ] + + ["License :: OSI Approved :: Apache Software License"] +) PACKAGE_DIRECTORIES = { "": ".", @@ -96,7 +99,7 @@ def run(self): classifiers=CLASSIFIERS, package_dir=PACKAGE_DIRECTORIES, packages=setuptools.find_packages("."), - python_requires=">=3.8", + python_requires=f">={python_version.MIN_PYTHON_VERSION}", install_requires=INSTALL_REQUIRES, setup_requires=SETUP_REQUIRES, cmdclass=COMMAND_CLASS, diff --git a/src/python/grpcio_observability/MANIFEST.in b/src/python/grpcio_observability/MANIFEST.in index 8efdc8f6f21794..ffd7f861231634 100644 --- a/src/python/grpcio_observability/MANIFEST.in +++ b/src/python/grpcio_observability/MANIFEST.in @@ -4,5 +4,6 @@ graft grpc_root graft third_party include _parallel_compile_patch.py include grpc_version.py +include python_version.py include observability_lib_deps.py include README.rst diff --git a/src/python/grpcio_observability/README.rst b/src/python/grpcio_observability/README.rst index 11ba92f90f5198..513ebe02112592 100644 --- a/src/python/grpcio_observability/README.rst +++ b/src/python/grpcio_observability/README.rst @@ -17,9 +17,6 @@ Note that while this approach enhances efficiency, it will introduce a slight de time the data is collected and the time it becomes available through Python exporters. -Supported Python Versions -------------------------- -Python >= 3.8 Installation ------------ diff --git a/src/python/grpcio_observability/python_version.py b/src/python/grpcio_observability/python_version.py new file mode 100644 index 00000000000000..aca7367b65c09e --- /dev/null +++ b/src/python/grpcio_observability/python_version.py @@ -0,0 +1,20 @@ +# Copyright 2024 gRPC authors. +# +# 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. + +# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_observability/python_version.py.template`!!! + +SUPPORTED_PYTHON_VERSIONS = ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] + +MIN_PYTHON_VERSION = 3.8 +MAX_PYTHON_VERSION = 3.13 diff --git a/src/python/grpcio_observability/setup.py b/src/python/grpcio_observability/setup.py index 60be8deee928ff..1bf43a8170fa21 100644 --- a/src/python/grpcio_observability/setup.py +++ b/src/python/grpcio_observability/setup.py @@ -34,6 +34,7 @@ import _parallel_compile_patch import observability_lib_deps +import python_version import grpc_version @@ -287,7 +288,7 @@ def extension_modules(): classifiers=CLASSIFIERS, ext_modules=extension_modules(), packages=list(PACKAGES), - python_requires=">=3.8", + python_requires=f">={python_version.MIN_PYTHON_VERSION}", install_requires=[ "grpcio=={version}".format(version=grpc_version.VERSION), "setuptools>=59.6.0", diff --git a/src/python/grpcio_reflection/MANIFEST.in b/src/python/grpcio_reflection/MANIFEST.in index eefb53d31f8da3..547bdd2759792b 100644 --- a/src/python/grpcio_reflection/MANIFEST.in +++ b/src/python/grpcio_reflection/MANIFEST.in @@ -1,4 +1,5 @@ include grpc_version.py +include python_version.py recursive-include grpc_reflection *.py *.pyi global-exclude *.pyc include LICENSE diff --git a/src/python/grpcio_reflection/README.rst b/src/python/grpcio_reflection/README.rst index b954108cc45b19..abb54a57f14305 100644 --- a/src/python/grpcio_reflection/README.rst +++ b/src/python/grpcio_reflection/README.rst @@ -3,9 +3,6 @@ gRPC Python Reflection package Reference package for reflection in GRPC Python. -Supported Python Versions -------------------------- -Python >= 3.8 Dependencies ------------ diff --git a/src/python/grpcio_reflection/python_version.py b/src/python/grpcio_reflection/python_version.py new file mode 100644 index 00000000000000..e94e725d14d78c --- /dev/null +++ b/src/python/grpcio_reflection/python_version.py @@ -0,0 +1,20 @@ +# Copyright 2024 gRPC authors. +# +# 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. + +# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_reflection/python_version.py.template`!!! + +SUPPORTED_PYTHON_VERSIONS = ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] + +MIN_PYTHON_VERSION = 3.8 +MAX_PYTHON_VERSION = 3.13 diff --git a/src/python/grpcio_reflection/setup.py b/src/python/grpcio_reflection/setup.py index fd2cd7eb872f12..ca7e23219fd092 100644 --- a/src/python/grpcio_reflection/setup.py +++ b/src/python/grpcio_reflection/setup.py @@ -25,6 +25,8 @@ os.chdir(os.path.dirname(os.path.abspath(__file__))) # Break import-style to ensure we can actually find our local modules. +import python_version + import grpc_version @@ -44,17 +46,18 @@ def run(self): pass -CLASSIFIERS = [ - "Development Status :: 5 - Production/Stable", - "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", - "Programming Language :: Python :: 3.12", - "License :: OSI Approved :: Apache Software License", -] +CLASSIFIERS = ( + [ + "Development Status :: 5 - Production/Stable", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + ] + + [ + f"Programming Language :: Python :: {x}" + for x in python_version.SUPPORTED_PYTHON_VERSIONS + ] + + ["License :: OSI Approved :: Apache Software License"] +) PACKAGE_DIRECTORIES = { "": ".", @@ -97,7 +100,7 @@ def run(self): url="https://grpc.io", package_dir=PACKAGE_DIRECTORIES, packages=setuptools.find_packages("."), - python_requires=">=3.8", + python_requires=f">={python_version.MIN_PYTHON_VERSION}", install_requires=INSTALL_REQUIRES, setup_requires=SETUP_REQUIRES, cmdclass=COMMAND_CLASS, diff --git a/src/python/grpcio_status/MANIFEST.in b/src/python/grpcio_status/MANIFEST.in index 3ecc88ec2dd3f6..62439177f19f87 100644 --- a/src/python/grpcio_status/MANIFEST.in +++ b/src/python/grpcio_status/MANIFEST.in @@ -1,4 +1,5 @@ include grpc_version.py +include python_version.py include grpc_status/google/rpc/status.proto recursive-include grpc_status *.py global-exclude *.pyc diff --git a/src/python/grpcio_status/README.rst b/src/python/grpcio_status/README.rst index bfc753c799e5e7..c2c8efcc0c7587 100644 --- a/src/python/grpcio_status/README.rst +++ b/src/python/grpcio_status/README.rst @@ -3,9 +3,6 @@ gRPC Python Status Proto Reference package for GRPC Python status proto mapping. -Supported Python Versions -------------------------- -Python >= 3.8 Dependencies ------------ diff --git a/src/python/grpcio_status/python_version.py b/src/python/grpcio_status/python_version.py new file mode 100644 index 00000000000000..02de6673e4b958 --- /dev/null +++ b/src/python/grpcio_status/python_version.py @@ -0,0 +1,20 @@ +# Copyright 2024 gRPC authors. +# +# 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. + +# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_status/python_version.py.template`!!! + +SUPPORTED_PYTHON_VERSIONS = ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] + +MIN_PYTHON_VERSION = 3.8 +MAX_PYTHON_VERSION = 3.13 diff --git a/src/python/grpcio_status/setup.py b/src/python/grpcio_status/setup.py index f70013774c9b08..f98032d28b1e90 100644 --- a/src/python/grpcio_status/setup.py +++ b/src/python/grpcio_status/setup.py @@ -24,6 +24,8 @@ os.chdir(os.path.dirname(os.path.abspath(__file__))) # Break import-style to ensure we can actually find our local modules. +import python_version + import grpc_version @@ -43,17 +45,18 @@ def run(self): pass -CLASSIFIERS = [ - "Development Status :: 5 - Production/Stable", - "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", - "Programming Language :: Python :: 3.12", - "License :: OSI Approved :: Apache Software License", -] +CLASSIFIERS = ( + [ + "Development Status :: 5 - Production/Stable", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + ] + + [ + f"Programming Language :: Python :: {x}" + for x in python_version.SUPPORTED_PYTHON_VERSIONS + ] + + ["License :: OSI Approved :: Apache Software License"] +) PACKAGE_DIRECTORIES = { "": ".", @@ -93,7 +96,7 @@ def run(self): classifiers=CLASSIFIERS, package_dir=PACKAGE_DIRECTORIES, packages=setuptools.find_packages("."), - python_requires=">=3.8", + python_requires=f">={python_version.MIN_PYTHON_VERSION}", install_requires=INSTALL_REQUIRES, cmdclass=COMMAND_CLASS, ) diff --git a/src/python/grpcio_testing/README.rst b/src/python/grpcio_testing/README.rst index 1b8de5dca190f7..34fe05be9dc416 100644 --- a/src/python/grpcio_testing/README.rst +++ b/src/python/grpcio_testing/README.rst @@ -3,9 +3,6 @@ gRPC Python Testing Package Testing utilities for gRPC Python -Supported Python Versions -------------------------- -Python >= 3.8 Dependencies ------------ diff --git a/templates/src/python/grpcio/python_version.py.template b/templates/src/python/grpcio/python_version.py.template new file mode 100644 index 00000000000000..8c8da439184292 --- /dev/null +++ b/templates/src/python/grpcio/python_version.py.template @@ -0,0 +1,22 @@ +%YAML 1.2 +--- | + # Copyright 2024 gRPC authors. + # + # 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. + + # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/python_version.py.template`!!! + + SUPPORTED_PYTHON_VERSIONS = ${settings.supported_python_versions} + + MIN_PYTHON_VERSION = ${settings.min_python_version} + MAX_PYTHON_VERSION = ${settings.max_python_version} diff --git a/templates/src/python/grpcio_admin/python_version.py.template b/templates/src/python/grpcio_admin/python_version.py.template new file mode 100644 index 00000000000000..d904c1d722817c --- /dev/null +++ b/templates/src/python/grpcio_admin/python_version.py.template @@ -0,0 +1,22 @@ +%YAML 1.2 +--- | + # Copyright 2024 gRPC authors. + # + # 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. + + # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_admin/python_version.py.template`!!! + + SUPPORTED_PYTHON_VERSIONS = ${settings.supported_python_versions} + + MIN_PYTHON_VERSION = ${settings.min_python_version} + MAX_PYTHON_VERSION = ${settings.max_python_version} diff --git a/templates/src/python/grpcio_channelz/grpc_version.py.template b/templates/src/python/grpcio_channelz/grpc_version.py.template index 75d510cd17bde0..999c102525772f 100644 --- a/templates/src/python/grpcio_channelz/grpc_version.py.template +++ b/templates/src/python/grpcio_channelz/grpc_version.py.template @@ -14,6 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_channelz/grpc_version.py.template`!!! + # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_channelz/python_version.py.template`!!! VERSION = '${settings.python_version.pep440()}' diff --git a/templates/src/python/grpcio_channelz/python_version.py.template b/templates/src/python/grpcio_channelz/python_version.py.template new file mode 100644 index 00000000000000..e0630bb7aa19be --- /dev/null +++ b/templates/src/python/grpcio_channelz/python_version.py.template @@ -0,0 +1,22 @@ +%YAML 1.2 +--- | + # Copyright 2024 gRPC authors. + # + # 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. + + # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_channelz/python_version.py.template`!!! + + SUPPORTED_PYTHON_VERSIONS = ${settings.supported_python_versions} + + MIN_PYTHON_VERSION = ${settings.min_python_version} + MAX_PYTHON_VERSION = ${settings.max_python_version} diff --git a/templates/src/python/grpcio_csds/python_version.py.template b/templates/src/python/grpcio_csds/python_version.py.template new file mode 100644 index 00000000000000..a5cc8627ecb2a9 --- /dev/null +++ b/templates/src/python/grpcio_csds/python_version.py.template @@ -0,0 +1,22 @@ +%YAML 1.2 +--- | + # Copyright 2024 gRPC authors. + # + # 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. + + # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_csds/python_version.py.template`!!! + + SUPPORTED_PYTHON_VERSIONS = ${settings.supported_python_versions} + + MIN_PYTHON_VERSION = ${settings.min_python_version} + MAX_PYTHON_VERSION = ${settings.max_python_version} diff --git a/templates/src/python/grpcio_csm_observability/python_version.py.template b/templates/src/python/grpcio_csm_observability/python_version.py.template new file mode 100644 index 00000000000000..2aa52d73111fe4 --- /dev/null +++ b/templates/src/python/grpcio_csm_observability/python_version.py.template @@ -0,0 +1,22 @@ +%YAML 1.2 +--- | + # Copyright 2024 gRPC authors. + # + # 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. + + # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_csm_observability/python_version.py.template`!!! + + SUPPORTED_PYTHON_VERSIONS = ${settings.supported_python_versions} + + MIN_PYTHON_VERSION = ${settings.min_python_version} + MAX_PYTHON_VERSION = ${settings.max_python_version} diff --git a/templates/src/python/grpcio_health_checking/python_version.py.template b/templates/src/python/grpcio_health_checking/python_version.py.template new file mode 100644 index 00000000000000..6646f69979a9a3 --- /dev/null +++ b/templates/src/python/grpcio_health_checking/python_version.py.template @@ -0,0 +1,22 @@ +%YAML 1.2 +--- | + # Copyright 2024 gRPC authors. + # + # 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. + + # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_health_checking/python_version.py.template`!!! + + SUPPORTED_PYTHON_VERSIONS = ${settings.supported_python_versions} + + MIN_PYTHON_VERSION = ${settings.min_python_version} + MAX_PYTHON_VERSION = ${settings.max_python_version} diff --git a/templates/src/python/grpcio_observability/python_version.py.template b/templates/src/python/grpcio_observability/python_version.py.template new file mode 100644 index 00000000000000..f82b1c2d7a52aa --- /dev/null +++ b/templates/src/python/grpcio_observability/python_version.py.template @@ -0,0 +1,22 @@ +%YAML 1.2 +--- | + # Copyright 2024 gRPC authors. + # + # 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. + + # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_observability/python_version.py.template`!!! + + SUPPORTED_PYTHON_VERSIONS = ${settings.supported_python_versions} + + MIN_PYTHON_VERSION = ${settings.min_python_version} + MAX_PYTHON_VERSION = ${settings.max_python_version} diff --git a/templates/src/python/grpcio_reflection/python_version.py.template b/templates/src/python/grpcio_reflection/python_version.py.template new file mode 100644 index 00000000000000..29d9d47cffc52f --- /dev/null +++ b/templates/src/python/grpcio_reflection/python_version.py.template @@ -0,0 +1,22 @@ +%YAML 1.2 +--- | + # Copyright 2024 gRPC authors. + # + # 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. + + # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_reflection/python_version.py.template`!!! + + SUPPORTED_PYTHON_VERSIONS = ${settings.supported_python_versions} + + MIN_PYTHON_VERSION = ${settings.min_python_version} + MAX_PYTHON_VERSION = ${settings.max_python_version} diff --git a/templates/src/python/grpcio_status/python_version.py.template b/templates/src/python/grpcio_status/python_version.py.template new file mode 100644 index 00000000000000..cb6aeda5a05d09 --- /dev/null +++ b/templates/src/python/grpcio_status/python_version.py.template @@ -0,0 +1,22 @@ +%YAML 1.2 +--- | + # Copyright 2024 gRPC authors. + # + # 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. + + # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_status/python_version.py.template`!!! + + SUPPORTED_PYTHON_VERSIONS = ${settings.supported_python_versions} + + MIN_PYTHON_VERSION = ${settings.min_python_version} + MAX_PYTHON_VERSION = ${settings.max_python_version} diff --git a/templates/tools/distrib/python/grpc_version.py.template b/templates/tools/distrib/python/grpc_version.py.template index 5031353b871bbe..0d36735631d7ec 100644 --- a/templates/tools/distrib/python/grpc_version.py.template +++ b/templates/tools/distrib/python/grpc_version.py.template @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. - # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/grpc_version.py.template`!!! + # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpc_version.py.template`!!! VERSION = '${settings.python_version.pep440()}' PROTOBUF_VERSION = '${settings.protobuf_version}' diff --git a/templates/tools/distrib/python/grpcio_tools/grpc_tools/python_version.py.template b/templates/tools/distrib/python/grpcio_tools/grpc_tools/python_version.py.template new file mode 100644 index 00000000000000..6e06a5a4bb8ab3 --- /dev/null +++ b/templates/tools/distrib/python/grpcio_tools/grpc_tools/python_version.py.template @@ -0,0 +1,22 @@ +%YAML 1.2 +--- | + # Copyright 2024 gRPC authors. + # + # 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. + + # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/grpc_tools/python_version.py.template`!!! + + SUPPORTED_PYTHON_VERSIONS = ${settings.supported_python_versions} + + MIN_PYTHON_VERSION = ${settings.min_python_version} + MAX_PYTHON_VERSION = ${settings.max_python_version} diff --git a/templates/tools/distrib/python/grpcio_tools/python_version.py.template b/templates/tools/distrib/python/grpcio_tools/python_version.py.template new file mode 100644 index 00000000000000..a40390110d8706 --- /dev/null +++ b/templates/tools/distrib/python/grpcio_tools/python_version.py.template @@ -0,0 +1,22 @@ +%YAML 1.2 +--- | + # Copyright 2024 gRPC authors. + # + # 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. + + # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/python_version.py.template`!!! + + SUPPORTED_PYTHON_VERSIONS = ${settings.supported_python_versions} + + MIN_PYTHON_VERSION = ${settings.min_python_version} + MAX_PYTHON_VERSION = ${settings.max_python_version} diff --git a/templates/tools/distrib/python/xds_protos/grpc_version.py.template b/templates/tools/distrib/python/xds_protos/grpc_version.py.template index 7808e28e2197e4..ba301d6b8658a5 100644 --- a/templates/tools/distrib/python/xds_protos/grpc_version.py.template +++ b/templates/tools/distrib/python/xds_protos/grpc_version.py.template @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. - # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/grpc_version.py.template`!!! + # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/xds_protos/grpc_version.py.template`!!! VERSION = '${settings.python_version.pep440()}' PROTOBUF_VERSION = '${settings.protobuf_version}' diff --git a/templates/tools/distrib/python/xds_protos/python_version.py.template b/templates/tools/distrib/python/xds_protos/python_version.py.template new file mode 100644 index 00000000000000..6f9d0562f32abb --- /dev/null +++ b/templates/tools/distrib/python/xds_protos/python_version.py.template @@ -0,0 +1,22 @@ +%YAML 1.2 +--- | + # Copyright 2024 gRPC authors. + # + # 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. + + # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/xds_protos/python_version.py.template`!!! + + SUPPORTED_PYTHON_VERSIONS = ${settings.supported_python_versions} + + MIN_PYTHON_VERSION = ${settings.min_python_version} + MAX_PYTHON_VERSION = ${settings.max_python_version} diff --git a/templates/tools/dockerfile/ccache_crosscompile.include b/templates/tools/dockerfile/ccache_crosscompile.include new file mode 100644 index 00000000000000..04136e01b5365e --- /dev/null +++ b/templates/tools/dockerfile/ccache_crosscompile.include @@ -0,0 +1,14 @@ +#================= +# Install ccache + +# Install ccache from source since ccache 3.x packaged with most linux distributions +# does not support Redis backend for caching. +RUN unset CMAKE_TOOLCHAIN_FILE && unset AS AR CC CPP CXX LD STRIP OBJCOPY ${'\\'} + && curl -sSL -o ccache.tar.gz https://github.com/ccache/ccache/releases/download/v4.7.5/ccache-4.7.5.tar.gz ${'\\'} + && tar -zxf ccache.tar.gz ${'\\'} + && cd ccache-4.7.5 ${'\\'} + && mkdir build && cd build ${'\\'} + && cmake -DCMAKE_BUILD_TYPE=Release -DZSTD_FROM_INTERNET=ON -DHIREDIS_FROM_INTERNET=ON .. ${'\\'} + && make -j4 && make install ${'\\'} + && cd ../.. ${'\\'} + && rm -rf ccache-4.7.5 ccache.tar.gz diff --git a/templates/tools/dockerfile/compile_python_313.include b/templates/tools/dockerfile/compile_python_313.include new file mode 100644 index 00000000000000..e7d4bd38a9b547 --- /dev/null +++ b/templates/tools/dockerfile/compile_python_313.include @@ -0,0 +1,21 @@ +#================= +# Compile CPython 3.13.0rc2 from source + +RUN apt-get update && apt-get install -y zlib1g-dev libssl-dev libsqlite3-dev && apt-get clean +RUN apt-get update && apt-get install -y jq build-essential libffi-dev && apt-get clean + +RUN cd /tmp && ${'\\'} + wget -q https://www.python.org/ftp/python/3.13.0/Python-3.13.0rc2.tgz && ${'\\'} + tar xzvf Python-3.13.0rc2.tgz && ${'\\'} + cd Python-3.13.0rc2 && ${'\\'} + ./configure && ${'\\'} + make -j4 && ${'\\'} + make install + + +RUN cd /tmp && ${'\\'} + echo "ad7f44153649e27ec385e7633e853e03 Python-3.13.0rc2.tgz" > checksum.md5 && ${'\\'} + md5sum -c checksum.md5 + +RUN python3.13 -m ensurepip && ${'\\'} + python3.13 -m pip install coverage diff --git a/templates/tools/dockerfile/git_config.include b/templates/tools/dockerfile/git_config.include new file mode 100644 index 00000000000000..ad2ed5f3614ea5 --- /dev/null +++ b/templates/tools/dockerfile/git_config.include @@ -0,0 +1,22 @@ +# TODO: simplify the list of third_party modules list +# NOTE: git>=2.46 allows leading paths like third_party/* to include all subdirectories +# current docker base images use git versions lower than 2.46 and hence require separate configs for each submodule +RUN git config --global --add safe.directory /var/local/jenkins/grpc +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/bloaty +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/xds +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/googleapis +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/googletest +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/opentelemetry +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/opencensus-proto +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/boringssl-with-bazel +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/envoy-api +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/protobuf +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/zlib +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/benchmark +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/re2 +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/abseil-cpp +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/opentelemetry-cpp +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/protoc-gen-validate +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/cares/cares +RUN git config --global protocol.file.allow always \ No newline at end of file diff --git a/templates/tools/dockerfile/grpc_artifact_python_linux_armv7/Dockerfile.template b/templates/tools/dockerfile/grpc_artifact_python_linux_armv7/Dockerfile.template new file mode 100644 index 00000000000000..94671a0a585a4c --- /dev/null +++ b/templates/tools/dockerfile/grpc_artifact_python_linux_armv7/Dockerfile.template @@ -0,0 +1,57 @@ +%YAML 1.2 +--- | + # Copyright 2024 The gRPC Authors + # + # 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. + + # The aarch64 wheels are being crosscompiled to allow running the build + # on x64 machine. The dockcross/linux-armv7 image is a x86_64 + # image with crosscompilation toolchain installed + + # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/dockerfile/grpc_artifact_python_linux_armv7/Dockerfile.template`!!! + FROM dockcross/linux-armv7 + + <%text>RUN apt update && apt install -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev \ + libnss3-dev libssl-dev libreadline-dev libffi-dev && apt-get clean + + ADD install_python_for_wheel_crosscompilation.sh /scripts/install_python_for_wheel_crosscompilation.sh + + RUN /scripts/install_python_for_wheel_crosscompilation.sh "3.8.8" "3.8.8" /opt/python/cp38-cp38 + RUN /scripts/install_python_for_wheel_crosscompilation.sh "3.9.2" "3.9.2" /opt/python/cp39-cp39 + RUN /scripts/install_python_for_wheel_crosscompilation.sh "3.10.0" "3.10.0rc1" /opt/python/cp310-cp310 + RUN /scripts/install_python_for_wheel_crosscompilation.sh "3.11.0" "3.11.0rc1" /opt/python/cp311-cp311 + RUN /scripts/install_python_for_wheel_crosscompilation.sh "3.12.0" "3.12.0rc2" /opt/python/cp312-cp312 + RUN /scripts/install_python_for_wheel_crosscompilation.sh "3.13.0" "3.13.0rc2" /opt/python/cp313-cp313 + + ENV AUDITWHEEL_ARCH armv7l + ENV AUDITWHEEL_PLAT linux_armv7l + + <%include file="../ccache_crosscompile.include"/> + + # The dockcross base of this image sets CC and CXX to absolute paths, which makes it impossible to redirect their invocations + # to ccache via a symlink. Use relative paths instead. + <%text> + ENV CC ${CROSS_TRIPLE}-gcc + ENV CXX ${CROSS_TRIPLE}-g++ + + + # For historical reasons, task_runner.py the script under docker container using "bash -l" + # which loads /etc/profile on startup. dockcross/linux-armv7 is based on an image where + # /etc/profile overwrites contents of PATH (for security reasons) when run as root. + # That causes the crosscompiler binaries located under /usr/xcc/armv7-unknown-linux-gnueabi/bin + # to be removed from PATH. Since in our builds we don't need the /etc/profile for anything, we can just + # truncate it. + # TODO(jtattermusch): Remove this hack when possible. + RUN echo "# file contents removed to avoid resetting PATH set by the docker image" >/etc/profile + + <%include file="../git_config.include"/> diff --git a/templates/tools/dockerfile/grpc_artifact_python_manylinux2014_aarch64/Dockerfile.template b/templates/tools/dockerfile/grpc_artifact_python_manylinux2014_aarch64/Dockerfile.template new file mode 100644 index 00000000000000..31c1be4aed5b39 --- /dev/null +++ b/templates/tools/dockerfile/grpc_artifact_python_manylinux2014_aarch64/Dockerfile.template @@ -0,0 +1,28 @@ +%YAML 1.2 +--- | + # Copyright 2024 The gRPC Authors + # + # 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. + + # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/dockerfile/grpc_artifact_python_manylinux2014_aarch64/Dockerfile.template`!!! + + FROM dockcross/manylinux2014-aarch64:20240812-60fa1b0 + + # manylinux_2_17 is the preferred alias of manylinux2014 + ENV AUDITWHEEL_PLAT manylinux_2_17_$AUDITWHEEL_ARCH + + <%include file="../python_pip_builds.include"/> + + <%include file="../ccache_crosscompile.include"/> + + <%include file="../git_config.include"/> diff --git a/templates/tools/dockerfile/grpc_artifact_python_manylinux2014_x64/Dockerfile.template b/templates/tools/dockerfile/grpc_artifact_python_manylinux2014_x64/Dockerfile.template new file mode 100644 index 00000000000000..cf68868594e319 --- /dev/null +++ b/templates/tools/dockerfile/grpc_artifact_python_manylinux2014_x64/Dockerfile.template @@ -0,0 +1,33 @@ +%YAML 1.2 +--- | + # Copyright 2024 The gRPC Authors + # + # 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. + + # Docker file for building gRPC manylinux Python artifacts. + + # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/dockerfile/grpc_artifact_python_manylinux2014_x64/Dockerfile.template`!!! + + FROM quay.io/pypa/manylinux2014_x86_64:2024-09-09-f386546 + + # manylinux_2_17 is the preferred alias of manylinux2014 + ENV AUDITWHEEL_PLAT manylinux_2_17_$AUDITWHEEL_ARCH + + # TODO(jtattermusch): revisit which of the deps are really required + RUN yum update -y && yum install -y curl-devel expat-devel gettext-devel openssl-devel zlib-devel + + <%include file="../python_pip_builds.include"/> + + <%include file="../ccache.include"/> + + <%include file="../git_config.include"/> \ No newline at end of file diff --git a/templates/tools/dockerfile/grpc_artifact_python_manylinux2014_x86/Dockerfile.template b/templates/tools/dockerfile/grpc_artifact_python_manylinux2014_x86/Dockerfile.template new file mode 100644 index 00000000000000..d681fd47354558 --- /dev/null +++ b/templates/tools/dockerfile/grpc_artifact_python_manylinux2014_x86/Dockerfile.template @@ -0,0 +1,34 @@ +%YAML 1.2 +--- | + # Copyright 2024 The gRPC Authors + # + # 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. + + # Docker file for building gRPC manylinux Python artifacts. + + # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/dockerfile/grpc_artifact_python_manylinux2014_x86/Dockerfile.template`!!! + + FROM quay.io/pypa/manylinux2014_i686:2024-09-09-f386546 + + # manylinux_2_17 is the preferred alias of manylinux2014 + ENV AUDITWHEEL_PLAT manylinux_2_17_$AUDITWHEEL_ARCH + + # TODO(jtattermusch): revisit which of the deps are really required + RUN yum update -y && yum install -y curl-devel expat-devel gettext-devel openssl-devel zlib-devel + + <%include file="../python_pip_builds.include"/> + + <%include file="../ccache.include"/> + + + <%include file="../git_config.include"/> \ No newline at end of file diff --git a/templates/tools/dockerfile/grpc_artifact_python_musllinux_1_1_x64/Dockerfile.template b/templates/tools/dockerfile/grpc_artifact_python_musllinux_1_1_x64/Dockerfile.template new file mode 100644 index 00000000000000..dfb62902711fed --- /dev/null +++ b/templates/tools/dockerfile/grpc_artifact_python_musllinux_1_1_x64/Dockerfile.template @@ -0,0 +1,27 @@ +%YAML 1.2 +--- | + # Copyright 2024 The gRPC Authors + # + # 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. + + # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/dockerfile/grpc_artifact_python_musllinux_1_1_x64/Dockerfile.template`!!! + + FROM quay.io/pypa/musllinux_1_1_x86_64:2024-09-09-f386546 + + <%include file="../python_pip_builds.include"/> + + <%include file="../ccache.include"/> + + <%include file="../git_config.include"/> + + RUN apk add openssl openssl-dev \ No newline at end of file diff --git a/templates/tools/dockerfile/grpc_artifact_python_musllinux_1_1_x86/Dockerfile.template b/templates/tools/dockerfile/grpc_artifact_python_musllinux_1_1_x86/Dockerfile.template new file mode 100644 index 00000000000000..6f7ca5a52a8a01 --- /dev/null +++ b/templates/tools/dockerfile/grpc_artifact_python_musllinux_1_1_x86/Dockerfile.template @@ -0,0 +1,25 @@ +%YAML 1.2 +--- | + # Copyright 2024 The gRPC Authors + # + # 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. + + # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/dockerfile/grpc_artifact_python_musllinux_1_1_x86/Dockerfile.template`!!! + + FROM quay.io/pypa/musllinux_1_1_i686:2024-09-09-f386546 + + <%include file="../python_pip_builds.include"/> + + <%include file="../ccache.include"/> + + <%include file="../git_config.include"/> diff --git a/templates/tools/dockerfile/python_pip_builds.include b/templates/tools/dockerfile/python_pip_builds.include new file mode 100644 index 00000000000000..e573a06333822e --- /dev/null +++ b/templates/tools/dockerfile/python_pip_builds.include @@ -0,0 +1,8 @@ +#=================================== +# Install Python build requirements +RUN /opt/python/cp38-cp38/bin/pip install --upgrade 'cython<4.0.0rc1' +RUN /opt/python/cp39-cp39/bin/pip install --upgrade 'cython<4.0.0rc1' +RUN /opt/python/cp310-cp310/bin/pip install --upgrade 'cython<4.0.0rc1' +RUN /opt/python/cp311-cp311/bin/pip install --upgrade 'cython<4.0.0rc1' +RUN /opt/python/cp312-cp312/bin/pip install --upgrade 'cython<4.0.0rc1' +RUN /opt/python/cp313-cp313/bin/pip install --upgrade 'cython<4.0.0rc1' \ No newline at end of file diff --git a/templates/tools/dockerfile/test/python_debian11_default_x64/Dockerfile.template b/templates/tools/dockerfile/test/python_debian11_default_x64/Dockerfile.template index 0981763f21d31a..a385ec8d602673 100644 --- a/templates/tools/dockerfile/test/python_debian11_default_x64/Dockerfile.template +++ b/templates/tools/dockerfile/test/python_debian11_default_x64/Dockerfile.template @@ -24,6 +24,7 @@ <%include file="../../compile_python_310.include"/> <%include file="../../compile_python_311.include"/> <%include file="../../compile_python_312.include"/> + <%include file="../../compile_python_313.include"/> # Python test coverage requires libsqlite3, and it have # to be installed before Python. diff --git a/test/distrib/bazel/python/WORKSPACE b/test/distrib/bazel/python/WORKSPACE index 3567f8a2ac0730..b56055fa741e12 100644 --- a/test/distrib/bazel/python/WORKSPACE +++ b/test/distrib/bazel/python/WORKSPACE @@ -29,7 +29,7 @@ load("@com_google_protobuf//bazel:system_python.bzl", "system_python") system_python( name = "system_python", - minimum_python_version = "3.7", + minimum_python_version = "3.8", ) load("@system_python//:pip.bzl", "pip_parse") diff --git a/tools/bazelify_tests/dockerimage_current_versions.bzl b/tools/bazelify_tests/dockerimage_current_versions.bzl index 5a349762058ddf..973a649dfe5850 100644 --- a/tools/bazelify_tests/dockerimage_current_versions.bzl +++ b/tools/bazelify_tests/dockerimage_current_versions.bzl @@ -63,12 +63,12 @@ DOCKERIMAGE_CURRENT_VERSIONS = { "tools/dockerfile/grpc_artifact_centos6_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_artifact_centos6_x64@sha256:3285047265ea2b7c5d4df4c769b2d05f56288d947c75e16d27ae2dee693f791b", "tools/dockerfile/grpc_artifact_centos6_x86.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_artifact_centos6_x86@sha256:19783239da92208f0f39cf563529cd02e889920497ef81c60d20391fa998af62", "tools/dockerfile/grpc_artifact_protoc_aarch64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_artifact_protoc_aarch64@sha256:a0f6b544c1b2fa75f73b26cb28281917153304e9df2789e93de0732494e6b651", - "tools/dockerfile/grpc_artifact_python_linux_armv7.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_artifact_python_linux_armv7@sha256:f109d6c22cadb053f6843a66ee827d74f34d6cbf75a32f455a9da099ed1bdc9c", - "tools/dockerfile/grpc_artifact_python_manylinux2014_aarch64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_artifact_python_manylinux2014_aarch64@sha256:3f0407d4db904b35a7665c2222db039994cd0c9bdb1a073a653ff8e6940081c9", - "tools/dockerfile/grpc_artifact_python_manylinux2014_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_artifact_python_manylinux2014_x64@sha256:89329900ec7fedc57cd89690acd34d07d726f6b896f60df987867737d0a0f5a8", - "tools/dockerfile/grpc_artifact_python_manylinux2014_x86.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_artifact_python_manylinux2014_x86@sha256:8fce8e094b00935dc1f2640b4c2b10216c5a8711c0f4444efbafcd8c355a75a8", - "tools/dockerfile/grpc_artifact_python_musllinux_1_1_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_artifact_python_musllinux_1_1_x64@sha256:c8e8eb24942a2910197cf5481d61e7cbce68b57bd6f35fae878b043b1f2c38bb", - "tools/dockerfile/grpc_artifact_python_musllinux_1_1_x86.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_artifact_python_musllinux_1_1_x86@sha256:c288f83435186ee675d004ee52c93195a51201bf2b5fe92581584d977a2499a3", + "tools/dockerfile/grpc_artifact_python_linux_armv7.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_artifact_python_linux_armv7@sha256:137616275fe59bf89849f7503779f9a5d9668dbf395fcc79a8221a8c38fa5bac", + "tools/dockerfile/grpc_artifact_python_manylinux2014_aarch64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_artifact_python_manylinux2014_aarch64@sha256:ad3233be3c3ad9e0c4b60f0176a853713a35e5c84ec9d9703996c67fa3e811b6", + "tools/dockerfile/grpc_artifact_python_manylinux2014_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_artifact_python_manylinux2014_x64@sha256:0e102df67f31aeb6afe68250603288c2f1c98ccf360d1c42d751b8451da94b48", + "tools/dockerfile/grpc_artifact_python_manylinux2014_x86.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_artifact_python_manylinux2014_x86@sha256:527e2e9ec4db0c52a53b50abfd59907a1b7e221168dc401686f6a48d33bddc5c", + "tools/dockerfile/grpc_artifact_python_musllinux_1_1_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_artifact_python_musllinux_1_1_x64@sha256:94b57e5ea31ebc29af734474bcaff3074770778e5d27557cdc06d755ee8bc7ed", + "tools/dockerfile/grpc_artifact_python_musllinux_1_1_x86.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_artifact_python_musllinux_1_1_x86@sha256:edf4a0c8333c9309e52f323aa7315bbc0e5643216613cab4ecd2bce3d1ec26c0", "tools/dockerfile/interoptest/grpc_interop_aspnetcore.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_interop_aspnetcore@sha256:8e2e732e78724a8382c340dca72e7653c5f82c251a3110fa2874cc00ba538878", "tools/dockerfile/interoptest/grpc_interop_cxx.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_interop_cxx@sha256:e5a474d33773d52ec6a8abbe2d61ee0c2a9c2b5f48793a5ea3b82c4445becf3f", "tools/dockerfile/interoptest/grpc_interop_dart.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_interop_dart@sha256:4915a280788126dad029858eb384dbbef2dc18cadccb434df6450dfd7a4929f2", @@ -109,7 +109,7 @@ DOCKERIMAGE_CURRENT_VERSIONS = { "tools/dockerfile/test/php7_debian11_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/php7_debian11_x64@sha256:34b02fd66832ebf49601bef95632753e6710a75755401c21332d50056ccd52d2", "tools/dockerfile/test/python_alpine_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/python_alpine_x64@sha256:0a4e3c166fb676d85ea26d9fffec3858d59a2f243a3acc1c2f9bd293a590a98c", "tools/dockerfile/test/python_debian11_default_arm64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/python_debian11_default_arm64@sha256:fccca33a655c7aa89dd7ebd9492cbcc1f636bd2a004cd939d1982cfce3d68326", - "tools/dockerfile/test/python_debian11_default_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/python_debian11_default_x64@sha256:4c539fc93d343324309939c2964204c90f4054cd9eeed093af315cb0f0ef7c26", + "tools/dockerfile/test/python_debian11_default_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/python_debian11_default_x64@sha256:8beca964d6bbb80a8cb4c4628c25e9702b007c97113e74e589fa50c15000738d", "tools/dockerfile/test/rbe_ubuntu2004.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/rbe_ubuntu2004@sha256:b3eb1a17b7b091e3c5648a803076b2c40601242ff91c04d55997af6641305f68", "tools/dockerfile/test/ruby_debian11_arm64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_debian11_arm64@sha256:d2e79919b2e2d4cc36a29682ecb5170641df4fb506cfb453978ffdeb8a841bd9", "tools/dockerfile/test/ruby_debian11_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_debian11_x64@sha256:6e8b4696ba0661f11a31ed0992a94d2efcd889a018f57160f0e2fb62963f3593", diff --git a/tools/bazelify_tests/test/BUILD b/tools/bazelify_tests/test/BUILD index 4aefd22e325c63..dee1d5172aa7f3 100644 --- a/tools/bazelify_tests/test/BUILD +++ b/tools/bazelify_tests/test/BUILD @@ -269,8 +269,8 @@ grpc_build_artifact_task( # Python artifact build tasks grpc_build_artifact_task( - name = "artifact_python_linux_x64_manylinux2014_cp312", - build_script = "build_artifact_python_linux_x64_cp312.sh", + name = "artifact_python_linux_x64_manylinux2014_cp313", + build_script = "build_artifact_python_linux_x64_cp313.sh", docker_image_version = "tools/dockerfile/grpc_artifact_python_manylinux2014_x64.current_version", ) @@ -287,7 +287,7 @@ grpc_build_artifact_task( name = "package_python_linux", # TODO(jtattermusch): add more python artifacts once they are migrated from artifact_targets.py artifact_deps = [ - "artifact_python_linux_x64_manylinux2014_cp312", + "artifact_python_linux_x64_manylinux2014_cp313", "artifact_python_linux_x64_manylinux2014_cp39", ], build_script = "build_package_python_linux.sh", @@ -421,7 +421,7 @@ test_suite( ":artifact_protoc_linux_aarch64_build_test", ":artifact_protoc_linux_x64_build_test", ":artifact_protoc_linux_x86_build_test", - ":artifact_python_linux_x64_manylinux2014_cp312_build_test", + ":artifact_python_linux_x64_manylinux2014_cp313_build_test", ":artifact_python_linux_x64_manylinux2014_cp39_build_test", ":package_csharp_linux_build_test", ":package_python_linux_build_test", diff --git a/tools/bazelify_tests/test/build_artifact_python_linux_x64_cp312.sh b/tools/bazelify_tests/test/build_artifact_python_linux_x64_cp313.sh similarity index 93% rename from tools/bazelify_tests/test/build_artifact_python_linux_x64_cp312.sh rename to tools/bazelify_tests/test/build_artifact_python_linux_x64_cp313.sh index 8604176c82e859..d8a0b6b2ec2f07 100755 --- a/tools/bazelify_tests/test/build_artifact_python_linux_x64_cp312.sh +++ b/tools/bazelify_tests/test/build_artifact_python_linux_x64_cp313.sh @@ -17,8 +17,8 @@ set -ex # env variable values extracted from PythonArtifact in tools/run_tests/artifacts/artifact_targets.py # TODO(jtattermusch): find a better way of configuring the python artifact build (the current approach mostly serves as a demonstration) -export PYTHON=/opt/python/cp312-cp312/bin/python -export PIP=/opt/python/cp312-cp312/bin/pip +export PYTHON=/opt/python/cp313-cp313/bin/python +export PIP=/opt/python/cp313-cp313/bin/pip export GRPC_SKIP_PIP_CYTHON_UPGRADE=TRUE export GRPC_RUN_AUDITWHEEL_REPAIR=TRUE export GRPC_BUILD_GRPCIO_TOOLS_DEPENDENTS=TRUE diff --git a/tools/buildgen/plugins/expand_supported_python_versions.py b/tools/buildgen/plugins/expand_supported_python_versions.py new file mode 100644 index 00000000000000..8cc4e814d74a3c --- /dev/null +++ b/tools/buildgen/plugins/expand_supported_python_versions.py @@ -0,0 +1,33 @@ +# Copyright 2024 gRPC authors. +# +# 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. +"""Buildgen python version plugin + +This parses the list of supported python versions from the yaml build file, and +creates custom strings for the minimum and maximum supported python versions. + +""" + + +def mako_plugin(dictionary): + """Expand version numbers: + - for each language, ensure there's a language_version tag in + settings (defaulting to the master version tag) + - expand version strings to major, minor, patch, and tag + """ + + settings = dictionary["settings"] + + supported_python_versions = settings["supported_python_versions"] + settings["min_python_version"] = supported_python_versions[0] + settings["max_python_version"] = supported_python_versions[-1] diff --git a/tools/distrib/install_all_python_modules.sh b/tools/distrib/install_all_python_modules.sh index b23b38cc624686..ab5823b95533be 100755 --- a/tools/distrib/install_all_python_modules.sh +++ b/tools/distrib/install_all_python_modules.sh @@ -59,4 +59,3 @@ pushd src/python; popd; done popd; - diff --git a/tools/distrib/python/grpc_version.py b/tools/distrib/python/grpc_version.py index 8cec1e10eca637..28f793690ef3ca 100644 --- a/tools/distrib/python/grpc_version.py +++ b/tools/distrib/python/grpc_version.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/grpc_version.py.template`!!! +# AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpc_version.py.template`!!! VERSION = '1.68.0.dev0' PROTOBUF_VERSION = '3.28.1' diff --git a/tools/distrib/python/grpcio_tools/MANIFEST.in b/tools/distrib/python/grpcio_tools/MANIFEST.in index 1393de652a86a4..e74fde44b91755 100644 --- a/tools/distrib/python/grpcio_tools/MANIFEST.in +++ b/tools/distrib/python/grpcio_tools/MANIFEST.in @@ -1,10 +1,12 @@ include _parallel_compile_patch.py include _spawn_patch.py include grpc_version.py +include python_version.py include protoc_deps.py include protoc_lib_deps.py include README.rst include grpc_tools/grpc_version.py +include grpc_tools/python_version.py graft grpc_tools graft grpc_root graft third_party diff --git a/tools/distrib/python/grpcio_tools/grpc_tools/python_version.py b/tools/distrib/python/grpcio_tools/grpc_tools/python_version.py new file mode 100644 index 00000000000000..0dcc71c1fdab7b --- /dev/null +++ b/tools/distrib/python/grpcio_tools/grpc_tools/python_version.py @@ -0,0 +1,20 @@ +# Copyright 2024 gRPC authors. +# +# 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. + +# AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/grpc_tools/python_version.py.template`!!! + +SUPPORTED_PYTHON_VERSIONS = ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] + +MIN_PYTHON_VERSION = 3.8 +MAX_PYTHON_VERSION = 3.13 diff --git a/tools/distrib/python/grpcio_tools/python_version.py b/tools/distrib/python/grpcio_tools/python_version.py new file mode 100644 index 00000000000000..fc59f030fbbd8f --- /dev/null +++ b/tools/distrib/python/grpcio_tools/python_version.py @@ -0,0 +1,20 @@ +# Copyright 2024 gRPC authors. +# +# 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. + +# AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/python_version.py.template`!!! + +SUPPORTED_PYTHON_VERSIONS = ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] + +MIN_PYTHON_VERSION = 3.8 +MAX_PYTHON_VERSION = 3.13 diff --git a/tools/distrib/python/grpcio_tools/setup.py b/tools/distrib/python/grpcio_tools/setup.py index d0173a6165889a..5e19b6314ed9c5 100644 --- a/tools/distrib/python/grpcio_tools/setup.py +++ b/tools/distrib/python/grpcio_tools/setup.py @@ -39,6 +39,7 @@ import _parallel_compile_patch import _spawn_patch import protoc_lib_deps +import python_version import grpc_version @@ -329,7 +330,7 @@ def extension_modules(): classifiers=CLASSIFIERS, ext_modules=extension_modules(), packages=setuptools.find_packages("."), - python_requires=">=3.8", + python_requires=f">={python_version.MIN_PYTHON_VERSION}", install_requires=[ "protobuf>=5.26.1,<6.0dev", "grpcio>={version}".format(version=grpc_version.VERSION), diff --git a/tools/distrib/python/xds_protos/MANIFEST.in b/tools/distrib/python/xds_protos/MANIFEST.in index d83c49b9186ded..3fea17ba661c8c 100644 --- a/tools/distrib/python/xds_protos/MANIFEST.in +++ b/tools/distrib/python/xds_protos/MANIFEST.in @@ -1 +1,2 @@ include grpc_version.py +include python_version.py \ No newline at end of file diff --git a/tools/distrib/python/xds_protos/grpc_version.py b/tools/distrib/python/xds_protos/grpc_version.py index 7add68a0e24340..170b505959b128 100644 --- a/tools/distrib/python/xds_protos/grpc_version.py +++ b/tools/distrib/python/xds_protos/grpc_version.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/grpc_version.py.template`!!! +# AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/xds_protos/grpc_version.py.template`!!! VERSION = '1.68.0.dev0' PROTOBUF_VERSION = '3.28.1' diff --git a/tools/distrib/python/xds_protos/python_version.py b/tools/distrib/python/xds_protos/python_version.py new file mode 100644 index 00000000000000..80cce2eb4c544d --- /dev/null +++ b/tools/distrib/python/xds_protos/python_version.py @@ -0,0 +1,20 @@ +# Copyright 2024 gRPC authors. +# +# 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. + +# AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/xds_protos/python_version.py.template`!!! + +SUPPORTED_PYTHON_VERSIONS = ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] + +MIN_PYTHON_VERSION = 3.8 +MAX_PYTHON_VERSION = 3.13 diff --git a/tools/distrib/python/xds_protos/setup.py b/tools/distrib/python/xds_protos/setup.py index f1c7247cc4b639..53a6fbdfecb2c9 100644 --- a/tools/distrib/python/xds_protos/setup.py +++ b/tools/distrib/python/xds_protos/setup.py @@ -19,6 +19,7 @@ import setuptools import grpc_version +import python_version WORK_DIR = os.path.dirname(os.path.abspath(__file__)) @@ -44,6 +45,7 @@ SETUP_REQUIRES = INSTALL_REQUIRES + ["grpcio-tools>=1.49.0"] + setuptools.setup( name="xds-protos", version=grpc_version.VERSION, @@ -55,7 +57,7 @@ author_email="grpc-io@googlegroups.com", url="https://grpc.io", license="Apache License 2.0", - python_requires=">=3.8", + python_requires=f">={python_version.MIN_PYTHON_VERSION}", install_requires=INSTALL_REQUIRES, setup_requires=SETUP_REQUIRES, classifiers=CLASSIFIERS, diff --git a/tools/dockerfile/README.md b/tools/dockerfile/README.md index 89c599d607911d..fbdc872f70f5a0 100644 --- a/tools/dockerfile/README.md +++ b/tools/dockerfile/README.md @@ -37,6 +37,7 @@ If you've made modifications to a dockerfile, you can upload the new version of registry as follows: If you haven't configured authentication in Docker for us-docker.pkg.dev previously, run: + ``` gcloud auth configure-docker us-docker.pkg.dev gcloud auth login @@ -45,6 +46,7 @@ gcloud auth login Rebuild the docker images that have been modified locally and upload the docker images to artifact registry (note that this won't overwrite the "old" versions of the docker image that are already in artifact registry) + ``` # Install qemu, binformat, and configure binfmt interpreters sudo apt-get install binfmt-support qemu-user-static @@ -58,6 +60,7 @@ tools/dockerfile/push_testing_images.sh Build modified docker images locally and don't push to artifact registry. This option is very useful for quick local experiments. The script is much faster if it doesn't have to interact with artifact registry: + ``` # very useful for local experiments LOCAL_ONLY_MODE=true tools/dockerfile/push_testing_images.sh @@ -69,6 +72,7 @@ In the past, our testing docker images were [hosted on dockerhub](https://hub.do but we are in the process of migrating them artifact registry now. This temporary feature might simplify the migration: + ``` # try pull existing images from dockerhub instead of building the from scratch locally. TRANSFER_FROM_DOCKERHUB=true tools/dockerfile/push_testing_images.sh diff --git a/tools/dockerfile/grpc_artifact_python_linux_armv7.current_version b/tools/dockerfile/grpc_artifact_python_linux_armv7.current_version index 2ddbcc9ba32eb8..0a9925704215ce 100644 --- a/tools/dockerfile/grpc_artifact_python_linux_armv7.current_version +++ b/tools/dockerfile/grpc_artifact_python_linux_armv7.current_version @@ -1 +1 @@ -us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_artifact_python_linux_armv7:0b87638ab97b433c6818be5124dcd89d479b3a8b@sha256:f109d6c22cadb053f6843a66ee827d74f34d6cbf75a32f455a9da099ed1bdc9c \ No newline at end of file +us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_artifact_python_linux_armv7:3523bf4a67fa9100deb8f48ee4833cb5a5e97697@sha256:137616275fe59bf89849f7503779f9a5d9668dbf395fcc79a8221a8c38fa5bac \ No newline at end of file diff --git a/tools/dockerfile/grpc_artifact_python_linux_armv7/Dockerfile b/tools/dockerfile/grpc_artifact_python_linux_armv7/Dockerfile index 40a22e6fe544c1..03aacb23b4920f 100644 --- a/tools/dockerfile/grpc_artifact_python_linux_armv7/Dockerfile +++ b/tools/dockerfile/grpc_artifact_python_linux_armv7/Dockerfile @@ -1,4 +1,4 @@ -# Copyright 2020 The gRPC Authors +# Copyright 2024 The gRPC Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,6 +15,8 @@ # The aarch64 wheels are being crosscompiled to allow running the build # on x64 machine. The dockcross/linux-armv7 image is a x86_64 # image with crosscompilation toolchain installed + +# AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/dockerfile/grpc_artifact_python_linux_armv7/Dockerfile.template`!!! FROM dockcross/linux-armv7 RUN apt update && apt install -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev \ @@ -22,37 +24,39 @@ RUN apt update && apt install -y build-essential zlib1g-dev libncurses5-dev libg ADD install_python_for_wheel_crosscompilation.sh /scripts/install_python_for_wheel_crosscompilation.sh -RUN /scripts/install_python_for_wheel_crosscompilation.sh "3.6.13" "3.6.13" /opt/python/cp36-cp36m -RUN /scripts/install_python_for_wheel_crosscompilation.sh "3.7.10" "3.7.10" /opt/python/cp37-cp37m RUN /scripts/install_python_for_wheel_crosscompilation.sh "3.8.8" "3.8.8" /opt/python/cp38-cp38 RUN /scripts/install_python_for_wheel_crosscompilation.sh "3.9.2" "3.9.2" /opt/python/cp39-cp39 RUN /scripts/install_python_for_wheel_crosscompilation.sh "3.10.0" "3.10.0rc1" /opt/python/cp310-cp310 RUN /scripts/install_python_for_wheel_crosscompilation.sh "3.11.0" "3.11.0rc1" /opt/python/cp311-cp311 RUN /scripts/install_python_for_wheel_crosscompilation.sh "3.12.0" "3.12.0rc2" /opt/python/cp312-cp312 +RUN /scripts/install_python_for_wheel_crosscompilation.sh "3.13.0" "3.13.0rc2" /opt/python/cp313-cp313 ENV AUDITWHEEL_ARCH armv7l ENV AUDITWHEEL_PLAT linux_armv7l #================= -# Install ccache +# Install ccache # Install ccache from source since ccache 3.x packaged with most linux distributions # does not support Redis backend for caching. -RUN unset CMAKE_TOOLCHAIN_FILE && unset AS AR CC CPP CXX LD \ - && curl -sSL -o ccache.tar.gz https://github.com/ccache/ccache/releases/download/v4.5.1/ccache-4.5.1.tar.gz \ +RUN unset CMAKE_TOOLCHAIN_FILE && unset AS AR CC CPP CXX LD STRIP OBJCOPY \ + && curl -sSL -o ccache.tar.gz https://github.com/ccache/ccache/releases/download/v4.7.5/ccache-4.7.5.tar.gz \ && tar -zxf ccache.tar.gz \ - && cd ccache-4.5.1 \ + && cd ccache-4.7.5 \ && mkdir build && cd build \ && cmake -DCMAKE_BUILD_TYPE=Release -DZSTD_FROM_INTERNET=ON -DHIREDIS_FROM_INTERNET=ON .. \ && make -j4 && make install \ && cd ../.. \ - && rm -rf ccache-4.5.1 ccache.tar.gz + && rm -rf ccache-4.7.5 ccache.tar.gz + # The dockcross base of this image sets CC and CXX to absolute paths, which makes it impossible to redirect their invocations # to ccache via a symlink. Use relative paths instead. + ENV CC ${CROSS_TRIPLE}-gcc ENV CXX ${CROSS_TRIPLE}-g++ + # For historical reasons, task_runner.py the script under docker container using "bash -l" # which loads /etc/profile on startup. dockcross/linux-armv7 is based on an image where # /etc/profile overwrites contents of PATH (for security reasons) when run as root. @@ -62,5 +66,25 @@ ENV CXX ${CROSS_TRIPLE}-g++ # TODO(jtattermusch): Remove this hack when possible. RUN echo "# file contents removed to avoid resetting PATH set by the docker image" >/etc/profile +# TODO: simplify the list of third_party modules list +# NOTE: git>=2.46 allows leading paths like third_party/* to include all subdirectories +# current docker base images use git versions lower than 2.46 and hence require separate configs for each submodule RUN git config --global --add safe.directory /var/local/jenkins/grpc +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/bloaty +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/xds +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/googleapis +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/googletest +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/opentelemetry +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/opencensus-proto +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/boringssl-with-bazel +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/envoy-api +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/protobuf +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/zlib +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/benchmark +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/re2 +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/abseil-cpp +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/opentelemetry-cpp +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/protoc-gen-validate +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/cares/cares RUN git config --global protocol.file.allow always diff --git a/tools/dockerfile/grpc_artifact_python_linux_armv7/install_python_for_wheel_crosscompilation.sh b/tools/dockerfile/grpc_artifact_python_linux_armv7/install_python_for_wheel_crosscompilation.sh index 08c6439d36a04b..f1f1d39509e9c7 100755 --- a/tools/dockerfile/grpc_artifact_python_linux_armv7/install_python_for_wheel_crosscompilation.sh +++ b/tools/dockerfile/grpc_artifact_python_linux_armv7/install_python_for_wheel_crosscompilation.sh @@ -44,4 +44,4 @@ popd rm -rf "Python-${PYTHON_VERSION}" # install cython and wheel -"${PYTHON_PREFIX}/bin/python3" -m pip install --upgrade 'cython<3.0.0rc1' wheel +"${PYTHON_PREFIX}/bin/python3" -m pip install --upgrade 'cython<4.0.0rc1' wheel diff --git a/tools/dockerfile/grpc_artifact_python_manylinux2014_aarch64.current_version b/tools/dockerfile/grpc_artifact_python_manylinux2014_aarch64.current_version index cdce8e543b4f18..cf67b2519079b5 100644 --- a/tools/dockerfile/grpc_artifact_python_manylinux2014_aarch64.current_version +++ b/tools/dockerfile/grpc_artifact_python_manylinux2014_aarch64.current_version @@ -1 +1 @@ -us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_artifact_python_manylinux2014_aarch64:cfc9fe0cb36bb4ec8425982fd7f07e4e14bf3941@sha256:3f0407d4db904b35a7665c2222db039994cd0c9bdb1a073a653ff8e6940081c9 \ No newline at end of file +us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_artifact_python_manylinux2014_aarch64:377f694f92dd1b56dff0b0a0f47d6e731200953c@sha256:ad3233be3c3ad9e0c4b60f0176a853713a35e5c84ec9d9703996c67fa3e811b6 \ No newline at end of file diff --git a/tools/dockerfile/grpc_artifact_python_manylinux2014_aarch64/Dockerfile b/tools/dockerfile/grpc_artifact_python_manylinux2014_aarch64/Dockerfile index 8e1c0751a8a90a..e4c3f8f306cc34 100644 --- a/tools/dockerfile/grpc_artifact_python_manylinux2014_aarch64/Dockerfile +++ b/tools/dockerfile/grpc_artifact_python_manylinux2014_aarch64/Dockerfile @@ -1,4 +1,4 @@ -# Copyright 2020 The gRPC Authors +# Copyright 2024 The gRPC Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,35 +12,57 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM dockcross/manylinux2014-aarch64:20230905-7b2d74f +# AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/dockerfile/grpc_artifact_python_manylinux2014_aarch64/Dockerfile.template`!!! + +FROM dockcross/manylinux2014-aarch64:20240812-60fa1b0 # manylinux_2_17 is the preferred alias of manylinux2014 ENV AUDITWHEEL_PLAT manylinux_2_17_$AUDITWHEEL_ARCH -################################### +#=================================== # Install Python build requirements -RUN /opt/python/cp36-cp36m/bin/pip install --upgrade 'cython<3.0.0rc1' -RUN /opt/python/cp37-cp37m/bin/pip install --upgrade 'cython<3.0.0rc1' -RUN /opt/python/cp38-cp38/bin/pip install --upgrade 'cython<3.0.0rc1' -RUN /opt/python/cp39-cp39/bin/pip install --upgrade 'cython<3.0.0rc1' -RUN /opt/python/cp310-cp310/bin/pip install --upgrade 'cython<3.0.0rc1' -RUN /opt/python/cp311-cp311/bin/pip install --upgrade 'cython<3.0.0rc1' -RUN /opt/python/cp312-cp312/bin/pip install --upgrade 'cython<3.0.0rc1' +RUN /opt/python/cp38-cp38/bin/pip install --upgrade 'cython<4.0.0rc1' +RUN /opt/python/cp39-cp39/bin/pip install --upgrade 'cython<4.0.0rc1' +RUN /opt/python/cp310-cp310/bin/pip install --upgrade 'cython<4.0.0rc1' +RUN /opt/python/cp311-cp311/bin/pip install --upgrade 'cython<4.0.0rc1' +RUN /opt/python/cp312-cp312/bin/pip install --upgrade 'cython<4.0.0rc1' +RUN /opt/python/cp313-cp313/bin/pip install --upgrade 'cython<4.0.0rc1' #================= -# Install ccache +# Install ccache # Install ccache from source since ccache 3.x packaged with most linux distributions # does not support Redis backend for caching. RUN unset CMAKE_TOOLCHAIN_FILE && unset AS AR CC CPP CXX LD STRIP OBJCOPY \ - && curl -sSL -o ccache.tar.gz https://github.com/ccache/ccache/releases/download/v4.5.1/ccache-4.5.1.tar.gz \ + && curl -sSL -o ccache.tar.gz https://github.com/ccache/ccache/releases/download/v4.7.5/ccache-4.7.5.tar.gz \ && tar -zxf ccache.tar.gz \ - && cd ccache-4.5.1 \ + && cd ccache-4.7.5 \ && mkdir build && cd build \ && cmake -DCMAKE_BUILD_TYPE=Release -DZSTD_FROM_INTERNET=ON -DHIREDIS_FROM_INTERNET=ON .. \ && make -j4 && make install \ && cd ../.. \ - && rm -rf ccache-4.5.1 ccache.tar.gz + && rm -rf ccache-4.7.5 ccache.tar.gz + +# TODO: simplify the list of third_party modules list +# NOTE: git>=2.46 allows leading paths like third_party/* to include all subdirectories +# current docker base images use git versions lower than 2.46 and hence require separate configs for each submodule RUN git config --global --add safe.directory /var/local/jenkins/grpc +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/bloaty +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/xds +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/googleapis +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/googletest +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/opentelemetry +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/opencensus-proto +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/boringssl-with-bazel +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/envoy-api +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/protobuf +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/zlib +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/benchmark +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/re2 +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/abseil-cpp +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/opentelemetry-cpp +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/protoc-gen-validate +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/cares/cares RUN git config --global protocol.file.allow always diff --git a/tools/dockerfile/grpc_artifact_python_manylinux2014_x64.current_version b/tools/dockerfile/grpc_artifact_python_manylinux2014_x64.current_version index c6f58ea8034b9d..b99340a7285d76 100644 --- a/tools/dockerfile/grpc_artifact_python_manylinux2014_x64.current_version +++ b/tools/dockerfile/grpc_artifact_python_manylinux2014_x64.current_version @@ -1 +1 @@ -us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_artifact_python_manylinux2014_x64:e81af0c6d454929785e8126fc993cbd93da5c014@sha256:89329900ec7fedc57cd89690acd34d07d726f6b896f60df987867737d0a0f5a8 \ No newline at end of file +us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_artifact_python_manylinux2014_x64:379c3240e9fd68b7c13a3b6cb24307a272558494@sha256:0e102df67f31aeb6afe68250603288c2f1c98ccf360d1c42d751b8451da94b48 \ No newline at end of file diff --git a/tools/dockerfile/grpc_artifact_python_manylinux2014_x64/Dockerfile b/tools/dockerfile/grpc_artifact_python_manylinux2014_x64/Dockerfile index ae959de2db4e90..ea75ed3af7cc32 100644 --- a/tools/dockerfile/grpc_artifact_python_manylinux2014_x64/Dockerfile +++ b/tools/dockerfile/grpc_artifact_python_manylinux2014_x64/Dockerfile @@ -1,4 +1,4 @@ -# Copyright 2020 The gRPC Authors +# Copyright 2024 The gRPC Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ # Docker file for building gRPC manylinux Python artifacts. -FROM quay.io/pypa/manylinux2014_x86_64:2023-09-17-ae90a16 +# AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/dockerfile/grpc_artifact_python_manylinux2014_x64/Dockerfile.template`!!! + +FROM quay.io/pypa/manylinux2014_x86_64:2024-09-09-f386546 # manylinux_2_17 is the preferred alias of manylinux2014 ENV AUDITWHEEL_PLAT manylinux_2_17_$AUDITWHEEL_ARCH @@ -22,29 +24,49 @@ ENV AUDITWHEEL_PLAT manylinux_2_17_$AUDITWHEEL_ARCH # TODO(jtattermusch): revisit which of the deps are really required RUN yum update -y && yum install -y curl-devel expat-devel gettext-devel openssl-devel zlib-devel -################################### +#=================================== # Install Python build requirements -RUN /opt/python/cp36-cp36m/bin/pip install --upgrade 'cython<3.0.0rc1' -RUN /opt/python/cp37-cp37m/bin/pip install --upgrade 'cython<3.0.0rc1' -RUN /opt/python/cp38-cp38/bin/pip install --upgrade 'cython<3.0.0rc1' -RUN /opt/python/cp39-cp39/bin/pip install --upgrade 'cython<3.0.0rc1' -RUN /opt/python/cp310-cp310/bin/pip install --upgrade 'cython<3.0.0rc1' -RUN /opt/python/cp311-cp311/bin/pip install --upgrade 'cython<3.0.0rc1' -RUN /opt/python/cp312-cp312/bin/pip install --upgrade 'cython<3.0.0rc1' +RUN /opt/python/cp38-cp38/bin/pip install --upgrade 'cython<4.0.0rc1' +RUN /opt/python/cp39-cp39/bin/pip install --upgrade 'cython<4.0.0rc1' +RUN /opt/python/cp310-cp310/bin/pip install --upgrade 'cython<4.0.0rc1' +RUN /opt/python/cp311-cp311/bin/pip install --upgrade 'cython<4.0.0rc1' +RUN /opt/python/cp312-cp312/bin/pip install --upgrade 'cython<4.0.0rc1' +RUN /opt/python/cp313-cp313/bin/pip install --upgrade 'cython<4.0.0rc1' #================= # Install ccache # Install ccache from source since ccache 3.x packaged with most linux distributions # does not support Redis backend for caching. -RUN curl -sSL -o ccache.tar.gz https://github.com/ccache/ccache/releases/download/v4.5.1/ccache-4.5.1.tar.gz \ +RUN curl -sSL -o ccache.tar.gz https://github.com/ccache/ccache/releases/download/v4.7.5/ccache-4.7.5.tar.gz \ && tar -zxf ccache.tar.gz \ - && cd ccache-4.5.1 \ + && cd ccache-4.7.5 \ && mkdir build && cd build \ && cmake -DCMAKE_BUILD_TYPE=Release -DZSTD_FROM_INTERNET=ON -DHIREDIS_FROM_INTERNET=ON .. \ && make -j4 && make install \ && cd ../.. \ - && rm -rf ccache-4.5.1 ccache.tar.gz + && rm -rf ccache-4.7.5 ccache.tar.gz + +# TODO: simplify the list of third_party modules list +# NOTE: git>=2.46 allows leading paths like third_party/* to include all subdirectories +# current docker base images use git versions lower than 2.46 and hence require separate configs for each submodule RUN git config --global --add safe.directory /var/local/jenkins/grpc +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/bloaty +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/xds +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/googleapis +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/googletest +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/opentelemetry +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/opencensus-proto +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/boringssl-with-bazel +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/envoy-api +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/protobuf +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/zlib +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/benchmark +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/re2 +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/abseil-cpp +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/opentelemetry-cpp +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/protoc-gen-validate +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/cares/cares RUN git config --global protocol.file.allow always \ No newline at end of file diff --git a/tools/dockerfile/grpc_artifact_python_manylinux2014_x86.current_version b/tools/dockerfile/grpc_artifact_python_manylinux2014_x86.current_version index efbb3c35dbe9bf..67a5533afbdc27 100644 --- a/tools/dockerfile/grpc_artifact_python_manylinux2014_x86.current_version +++ b/tools/dockerfile/grpc_artifact_python_manylinux2014_x86.current_version @@ -1 +1 @@ -us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_artifact_python_manylinux2014_x86:fda00560d600eed356f8d6bef2cc8416d0a6b790@sha256:8fce8e094b00935dc1f2640b4c2b10216c5a8711c0f4444efbafcd8c355a75a8 \ No newline at end of file +us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_artifact_python_manylinux2014_x86:28eec3c9e027fd42f5852f696ed3e47aec91229b@sha256:527e2e9ec4db0c52a53b50abfd59907a1b7e221168dc401686f6a48d33bddc5c \ No newline at end of file diff --git a/tools/dockerfile/grpc_artifact_python_manylinux2014_x86/Dockerfile b/tools/dockerfile/grpc_artifact_python_manylinux2014_x86/Dockerfile index 7736403f098bf1..3ffa2f46bbb9bc 100644 --- a/tools/dockerfile/grpc_artifact_python_manylinux2014_x86/Dockerfile +++ b/tools/dockerfile/grpc_artifact_python_manylinux2014_x86/Dockerfile @@ -1,4 +1,4 @@ -# Copyright 2020 The gRPC Authors +# Copyright 2024 The gRPC Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,7 +14,9 @@ # Docker file for building gRPC manylinux Python artifacts. -FROM quay.io/pypa/manylinux2014_i686:2023-09-17-ae90a16 +# AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/dockerfile/grpc_artifact_python_manylinux2014_x86/Dockerfile.template`!!! + +FROM quay.io/pypa/manylinux2014_i686:2024-09-09-f386546 # manylinux_2_17 is the preferred alias of manylinux2014 ENV AUDITWHEEL_PLAT manylinux_2_17_$AUDITWHEEL_ARCH @@ -22,30 +24,50 @@ ENV AUDITWHEEL_PLAT manylinux_2_17_$AUDITWHEEL_ARCH # TODO(jtattermusch): revisit which of the deps are really required RUN yum update -y && yum install -y curl-devel expat-devel gettext-devel openssl-devel zlib-devel -################################### +#=================================== # Install Python build requirements -RUN /opt/python/cp36-cp36m/bin/pip install --upgrade 'cython<3.0.0rc1' -RUN /opt/python/cp37-cp37m/bin/pip install --upgrade 'cython<3.0.0rc1' -RUN /opt/python/cp38-cp38/bin/pip install --upgrade 'cython<3.0.0rc1' -RUN /opt/python/cp39-cp39/bin/pip install --upgrade 'cython<3.0.0rc1' -RUN /opt/python/cp310-cp310/bin/pip install --upgrade 'cython<3.0.0rc1' -RUN /opt/python/cp311-cp311/bin/pip install --upgrade 'cython<3.0.0rc1' -RUN /opt/python/cp312-cp312/bin/pip install --upgrade 'cython<3.0.0rc1' +RUN /opt/python/cp38-cp38/bin/pip install --upgrade 'cython<4.0.0rc1' +RUN /opt/python/cp39-cp39/bin/pip install --upgrade 'cython<4.0.0rc1' +RUN /opt/python/cp310-cp310/bin/pip install --upgrade 'cython<4.0.0rc1' +RUN /opt/python/cp311-cp311/bin/pip install --upgrade 'cython<4.0.0rc1' +RUN /opt/python/cp312-cp312/bin/pip install --upgrade 'cython<4.0.0rc1' +RUN /opt/python/cp313-cp313/bin/pip install --upgrade 'cython<4.0.0rc1' #================= # Install ccache # Install ccache from source since ccache 3.x packaged with most linux distributions # does not support Redis backend for caching. -RUN curl -sSL -o ccache.tar.gz https://github.com/ccache/ccache/releases/download/v4.5.1/ccache-4.5.1.tar.gz \ +RUN curl -sSL -o ccache.tar.gz https://github.com/ccache/ccache/releases/download/v4.7.5/ccache-4.7.5.tar.gz \ && tar -zxf ccache.tar.gz \ - && cd ccache-4.5.1 \ + && cd ccache-4.7.5 \ && mkdir build && cd build \ && cmake -DCMAKE_BUILD_TYPE=Release -DZSTD_FROM_INTERNET=ON -DHIREDIS_FROM_INTERNET=ON .. \ && make -j4 && make install \ && cd ../.. \ - && rm -rf ccache-4.5.1 ccache.tar.gz + && rm -rf ccache-4.7.5 ccache.tar.gz + +# TODO: simplify the list of third_party modules list +# NOTE: git>=2.46 allows leading paths like third_party/* to include all subdirectories +# current docker base images use git versions lower than 2.46 and hence require separate configs for each submodule RUN git config --global --add safe.directory /var/local/jenkins/grpc +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/bloaty +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/xds +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/googleapis +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/googletest +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/opentelemetry +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/opencensus-proto +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/boringssl-with-bazel +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/envoy-api +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/protobuf +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/zlib +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/benchmark +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/re2 +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/abseil-cpp +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/opentelemetry-cpp +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/protoc-gen-validate +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/cares/cares RUN git config --global protocol.file.allow always \ No newline at end of file diff --git a/tools/dockerfile/grpc_artifact_python_musllinux_1_1_x64.current_version b/tools/dockerfile/grpc_artifact_python_musllinux_1_1_x64.current_version index 5365ea4a4bedf9..af23ed31a5c398 100644 --- a/tools/dockerfile/grpc_artifact_python_musllinux_1_1_x64.current_version +++ b/tools/dockerfile/grpc_artifact_python_musllinux_1_1_x64.current_version @@ -1 +1 @@ -us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_artifact_python_musllinux_1_1_x64:2f56fcee2e4964359dddcd57bb9b066ceb8331ec@sha256:c8e8eb24942a2910197cf5481d61e7cbce68b57bd6f35fae878b043b1f2c38bb \ No newline at end of file +us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_artifact_python_musllinux_1_1_x64:1bc8405880fdad2b22f8a6422cd6198b0b54838a@sha256:94b57e5ea31ebc29af734474bcaff3074770778e5d27557cdc06d755ee8bc7ed \ No newline at end of file diff --git a/tools/dockerfile/grpc_artifact_python_musllinux_1_1_x64/Dockerfile b/tools/dockerfile/grpc_artifact_python_musllinux_1_1_x64/Dockerfile index a6eff9bbe715f2..dc16c9133b77b2 100644 --- a/tools/dockerfile/grpc_artifact_python_musllinux_1_1_x64/Dockerfile +++ b/tools/dockerfile/grpc_artifact_python_musllinux_1_1_x64/Dockerfile @@ -1,4 +1,4 @@ -# Copyright 2021 The gRPC Authors +# Copyright 2024 The gRPC Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,31 +12,55 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM quay.io/pypa/musllinux_1_1_x86_64:2023-09-17-ae90a16 +# AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/dockerfile/grpc_artifact_python_musllinux_1_1_x64/Dockerfile.template`!!! -################################### +FROM quay.io/pypa/musllinux_1_1_x86_64:2024-09-09-f386546 + +#=================================== # Install Python build requirements -RUN /opt/python/cp36-cp36m/bin/pip install --upgrade 'cython<3.0.0rc1' -RUN /opt/python/cp37-cp37m/bin/pip install --upgrade 'cython<3.0.0rc1' -RUN /opt/python/cp38-cp38/bin/pip install --upgrade 'cython<3.0.0rc1' -RUN /opt/python/cp39-cp39/bin/pip install --upgrade 'cython<3.0.0rc1' -RUN /opt/python/cp310-cp310/bin/pip install --upgrade 'cython<3.0.0rc1' -RUN /opt/python/cp311-cp311/bin/pip install --upgrade 'cython<3.0.0rc1' -RUN /opt/python/cp312-cp312/bin/pip install --upgrade 'cython<3.0.0rc1' +RUN /opt/python/cp38-cp38/bin/pip install --upgrade 'cython<4.0.0rc1' +RUN /opt/python/cp39-cp39/bin/pip install --upgrade 'cython<4.0.0rc1' +RUN /opt/python/cp310-cp310/bin/pip install --upgrade 'cython<4.0.0rc1' +RUN /opt/python/cp311-cp311/bin/pip install --upgrade 'cython<4.0.0rc1' +RUN /opt/python/cp312-cp312/bin/pip install --upgrade 'cython<4.0.0rc1' +RUN /opt/python/cp313-cp313/bin/pip install --upgrade 'cython<4.0.0rc1' #================= # Install ccache # Install ccache from source since ccache 3.x packaged with most linux distributions # does not support Redis backend for caching. -RUN curl -sSL -o ccache.tar.gz https://github.com/ccache/ccache/releases/download/v4.5.1/ccache-4.5.1.tar.gz \ +RUN curl -sSL -o ccache.tar.gz https://github.com/ccache/ccache/releases/download/v4.7.5/ccache-4.7.5.tar.gz \ && tar -zxf ccache.tar.gz \ - && cd ccache-4.5.1 \ + && cd ccache-4.7.5 \ && mkdir build && cd build \ && cmake -DCMAKE_BUILD_TYPE=Release -DZSTD_FROM_INTERNET=ON -DHIREDIS_FROM_INTERNET=ON .. \ && make -j4 && make install \ && cd ../.. \ - && rm -rf ccache-4.5.1 ccache.tar.gz + && rm -rf ccache-4.7.5 ccache.tar.gz + +# TODO: simplify the list of third_party modules list +# NOTE: git>=2.46 allows leading paths like third_party/* to include all subdirectories +# current docker base images use git versions lower than 2.46 and hence require separate configs for each submodule RUN git config --global --add safe.directory /var/local/jenkins/grpc -RUN git config --global protocol.file.allow always \ No newline at end of file +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/bloaty +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/xds +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/googleapis +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/googletest +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/opentelemetry +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/opencensus-proto +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/boringssl-with-bazel +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/envoy-api +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/protobuf +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/zlib +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/benchmark +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/re2 +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/abseil-cpp +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/opentelemetry-cpp +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/protoc-gen-validate +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/cares/cares +RUN git config --global protocol.file.allow always + +RUN apk add openssl openssl-dev \ No newline at end of file diff --git a/tools/dockerfile/grpc_artifact_python_musllinux_1_1_x86.current_version b/tools/dockerfile/grpc_artifact_python_musllinux_1_1_x86.current_version index c30b39b356a292..ba2e0cac19a885 100644 --- a/tools/dockerfile/grpc_artifact_python_musllinux_1_1_x86.current_version +++ b/tools/dockerfile/grpc_artifact_python_musllinux_1_1_x86.current_version @@ -1 +1 @@ -us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_artifact_python_musllinux_1_1_x86:9308dccacd76fb1782a43d97e6f5062b5b58576d@sha256:c288f83435186ee675d004ee52c93195a51201bf2b5fe92581584d977a2499a3 \ No newline at end of file +us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_artifact_python_musllinux_1_1_x86:358044420e0991fe284f49848145d5145cff42ac@sha256:edf4a0c8333c9309e52f323aa7315bbc0e5643216613cab4ecd2bce3d1ec26c0 \ No newline at end of file diff --git a/tools/dockerfile/grpc_artifact_python_musllinux_1_1_x86/Dockerfile b/tools/dockerfile/grpc_artifact_python_musllinux_1_1_x86/Dockerfile index c7ac549e98fcfb..6509ab15003c1c 100644 --- a/tools/dockerfile/grpc_artifact_python_musllinux_1_1_x86/Dockerfile +++ b/tools/dockerfile/grpc_artifact_python_musllinux_1_1_x86/Dockerfile @@ -1,4 +1,4 @@ -# Copyright 2021 The gRPC Authors +# Copyright 2024 The gRPC Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,31 +12,53 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM quay.io/pypa/musllinux_1_1_i686:2023-09-17-ae90a16 +# AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/dockerfile/grpc_artifact_python_musllinux_1_1_x86/Dockerfile.template`!!! -################################### +FROM quay.io/pypa/musllinux_1_1_i686:2024-09-09-f386546 + +#=================================== # Install Python build requirements -RUN /opt/python/cp36-cp36m/bin/pip install --upgrade 'cython<3.0.0rc1' -RUN /opt/python/cp37-cp37m/bin/pip install --upgrade 'cython<3.0.0rc1' -RUN /opt/python/cp38-cp38/bin/pip install --upgrade 'cython<3.0.0rc1' -RUN /opt/python/cp39-cp39/bin/pip install --upgrade 'cython<3.0.0rc1' -RUN /opt/python/cp310-cp310/bin/pip install --upgrade 'cython<3.0.0rc1' -RUN /opt/python/cp311-cp311/bin/pip install --upgrade 'cython<3.0.0rc1' -RUN /opt/python/cp312-cp312/bin/pip install --upgrade 'cython<3.0.0rc1' +RUN /opt/python/cp38-cp38/bin/pip install --upgrade 'cython<4.0.0rc1' +RUN /opt/python/cp39-cp39/bin/pip install --upgrade 'cython<4.0.0rc1' +RUN /opt/python/cp310-cp310/bin/pip install --upgrade 'cython<4.0.0rc1' +RUN /opt/python/cp311-cp311/bin/pip install --upgrade 'cython<4.0.0rc1' +RUN /opt/python/cp312-cp312/bin/pip install --upgrade 'cython<4.0.0rc1' +RUN /opt/python/cp313-cp313/bin/pip install --upgrade 'cython<4.0.0rc1' #================= # Install ccache # Install ccache from source since ccache 3.x packaged with most linux distributions # does not support Redis backend for caching. -RUN curl -sSL -o ccache.tar.gz https://github.com/ccache/ccache/releases/download/v4.5.1/ccache-4.5.1.tar.gz \ +RUN curl -sSL -o ccache.tar.gz https://github.com/ccache/ccache/releases/download/v4.7.5/ccache-4.7.5.tar.gz \ && tar -zxf ccache.tar.gz \ - && cd ccache-4.5.1 \ + && cd ccache-4.7.5 \ && mkdir build && cd build \ && cmake -DCMAKE_BUILD_TYPE=Release -DZSTD_FROM_INTERNET=ON -DHIREDIS_FROM_INTERNET=ON .. \ && make -j4 && make install \ && cd ../.. \ - && rm -rf ccache-4.5.1 ccache.tar.gz + && rm -rf ccache-4.7.5 ccache.tar.gz + +# TODO: simplify the list of third_party modules list +# NOTE: git>=2.46 allows leading paths like third_party/* to include all subdirectories +# current docker base images use git versions lower than 2.46 and hence require separate configs for each submodule RUN git config --global --add safe.directory /var/local/jenkins/grpc -RUN git config --global protocol.file.allow always \ No newline at end of file +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/bloaty +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/xds +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/googleapis +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/googletest +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/opentelemetry +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/opencensus-proto +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/boringssl-with-bazel +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/envoy-api +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/protobuf +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/zlib +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/benchmark +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/re2 +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/abseil-cpp +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/opentelemetry-cpp +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/protoc-gen-validate +RUN git config --global --add safe.directory /var/local/jenkins/grpc/.git/modules/third_party/cares/cares +RUN git config --global protocol.file.allow always diff --git a/tools/dockerfile/test/python_debian11_default_x64.current_version b/tools/dockerfile/test/python_debian11_default_x64.current_version index 70b0383e90a91e..8b82524dba6121 100644 --- a/tools/dockerfile/test/python_debian11_default_x64.current_version +++ b/tools/dockerfile/test/python_debian11_default_x64.current_version @@ -1 +1 @@ -us-docker.pkg.dev/grpc-testing/testing-images-public/python_debian11_default_x64:05951fbd0e77e8ba072d270ad08f0d4b6ac00841@sha256:4c539fc93d343324309939c2964204c90f4054cd9eeed093af315cb0f0ef7c26 \ No newline at end of file +us-docker.pkg.dev/grpc-testing/testing-images-public/python_debian11_default_x64:224d8dc6c8287ee247378888ac93b9fe9e36ec8c@sha256:8beca964d6bbb80a8cb4c4628c25e9702b007c97113e74e589fa50c15000738d \ No newline at end of file diff --git a/tools/dockerfile/test/python_debian11_default_x64/Dockerfile b/tools/dockerfile/test/python_debian11_default_x64/Dockerfile index 2ba17722bce693..e7c2c9a658dce8 100644 --- a/tools/dockerfile/test/python_debian11_default_x64/Dockerfile +++ b/tools/dockerfile/test/python_debian11_default_x64/Dockerfile @@ -173,6 +173,28 @@ RUN cd /tmp && \ RUN python3.12 -m ensurepip && \ python3.12 -m pip install coverage +#================= +# Compile CPython 3.13.0rc2 from source + +RUN apt-get update && apt-get install -y zlib1g-dev libssl-dev libsqlite3-dev && apt-get clean +RUN apt-get update && apt-get install -y jq build-essential libffi-dev && apt-get clean + +RUN cd /tmp && \ + wget -q https://www.python.org/ftp/python/3.13.0/Python-3.13.0rc2.tgz && \ + tar xzvf Python-3.13.0rc2.tgz && \ + cd Python-3.13.0rc2 && \ + ./configure && \ + make -j4 && \ + make install + + +RUN cd /tmp && \ + echo "ad7f44153649e27ec385e7633e853e03 Python-3.13.0rc2.tgz" > checksum.md5 && \ + md5sum -c checksum.md5 + +RUN python3.13 -m ensurepip && \ + python3.13 -m pip install coverage + # Python test coverage requires libsqlite3, and it have # to be installed before Python. diff --git a/tools/internal_ci/helper_scripts/install_python_interpreters.ps1 b/tools/internal_ci/helper_scripts/install_python_interpreters.ps1 index 902fa3b0965d7c..ddeaad711f8f45 100644 --- a/tools/internal_ci/helper_scripts/install_python_interpreters.ps1 +++ b/tools/internal_ci/helper_scripts/install_python_interpreters.ps1 @@ -149,3 +149,20 @@ $Python312x64Config = @{ PythonInstallerHash = "ea1993b5227fa4c8f45a06f5fbdd23b3" } Install-Python @Python312x64Config + +# Python 3.13 +$Python313x86Config = @{ + PythonVersion = "3.13.0" + PythonInstaller = "python-3.13.0rc2" + PythonInstallPath = "C:\Python313_32bit" + PythonInstallerHash = "647f429b5584d9ee2dd02fdc9c61a38e" +} +Install-Python @Python313x86Config + +$Python313x64Config = @{ + PythonVersion = "3.13.0" + PythonInstaller = "python-3.13.0rc2-amd64" + PythonInstallPath = "C:\Python313" + PythonInstallerHash = "0af5ad8734962267323ef45f384de3aa" +} +Install-Python @Python313x64Config \ No newline at end of file diff --git a/tools/internal_ci/helper_scripts/prepare_build_macos_rc b/tools/internal_ci/helper_scripts/prepare_build_macos_rc index 8b3de1ab8ffd31..1cfd4cba7cec48 100644 --- a/tools/internal_ci/helper_scripts/prepare_build_macos_rc +++ b/tools/internal_ci/helper_scripts/prepare_build_macos_rc @@ -176,6 +176,14 @@ then shasum -c /tmp/python_installer_checksum.sha256 time sudo installer -pkg ./python-3.12.0rc2-macos11.pkg -target / fi + + # Install Python 3.13 if it doesn't exist + if [ ! -f "/usr/local/bin/python3.13" ]; then + time curl -O https://www.python.org/ftp/python/3.13.0/python-3.13.0rc2-macos11.pkg + echo "75579065f9ee5c25207353fbe0f79275123ff556 python-3.13.0rc2-macos11.pkg" > /tmp/python_installer_checksum.sha256 + shasum -c /tmp/python_installer_checksum.sha256 + time sudo installer -pkg ./python-3.13.0rc2-macos11.pkg -target / + fi fi if [ "${PREPARE_BUILD_INSTALL_DEPS_CSHARP}" == "true" ] diff --git a/tools/internal_ci/helper_scripts/requirements.macos.txt b/tools/internal_ci/helper_scripts/requirements.macos.txt index 59a759b0ce2317..57c4fb7abf5bbf 100644 --- a/tools/internal_ci/helper_scripts/requirements.macos.txt +++ b/tools/internal_ci/helper_scripts/requirements.macos.txt @@ -1,4 +1,4 @@ -cython<3.0.0rc1 +cython<4.0.0rc1 cryptography==3.4.6 PyJWT==2.0.1 pyOpenSSL==20.0.1 diff --git a/tools/internal_ci/macos/grpc_distribtests_python.sh b/tools/internal_ci/macos/grpc_distribtests_python.sh index 8bd18de2e1d01a..fa651af4e8a72e 100644 --- a/tools/internal_ci/macos/grpc_distribtests_python.sh +++ b/tools/internal_ci/macos/grpc_distribtests_python.sh @@ -26,12 +26,12 @@ source tools/internal_ci/helper_scripts/prepare_build_macos_rc # TODO(jtattermusch): cleanup this prepare build step (needed for python artifact build) # install cython for all python versions -python3.7 -m pip install -U 'cython<3.0.0rc1' setuptools==65.4.1 wheel --user -python3.8 -m pip install -U 'cython<3.0.0rc1' setuptools==65.4.1 wheel --user -python3.9 -m pip install -U 'cython<3.0.0rc1' setuptools==65.4.1 wheel --user -python3.10 -m pip install -U 'cython<3.0.0rc1' setuptools==65.4.1 wheel --user -python3.11 -m pip install -U 'cython<3.0.0rc1' setuptools==65.4.1 wheel --user -python3.12 -m pip install -U 'cython<3.0.0rc1' setuptools==65.4.1 wheel --user +python3.8 -m pip install -U 'cython<4.0.0rc1' setuptools==65.4.1 wheel --user +python3.9 -m pip install -U 'cython<4.0.0rc1' setuptools==65.4.1 wheel --user +python3.10 -m pip install -U 'cython<4.0.0rc1' setuptools==65.4.1 wheel --user +python3.11 -m pip install -U 'cython<4.0.0rc1' setuptools==65.4.1 wheel --user +python3.12 -m pip install -U 'cython<4.0.0rc1' setuptools==65.4.1 wheel --user +python3.13 -m pip install -U 'cython<4.0.0rc1' setuptools==65.4.1 wheel --user # Build all python macos artifacts (this step actually builds all the binary wheels and source archives) tools/run_tests/task_runner.py -f artifact macos python ${TASK_RUNNER_EXTRA_FILTERS} -j 2 -x build_artifacts/sponge_log.xml || FAILED="true" diff --git a/tools/run_tests/artifacts/artifact_targets.py b/tools/run_tests/artifacts/artifact_targets.py index 3146af9266ac06..6f00c17fa033d3 100644 --- a/tools/run_tests/artifacts/artifact_targets.py +++ b/tools/run_tests/artifacts/artifact_targets.py @@ -165,6 +165,7 @@ def build_jobspec(self, inner_jobs=None): elif "manylinux" in self.platform: if self.arch == "x86": environ["SETARCH_CMD"] = "linux32" + environ["GRPC_SKIP_TWINE_CHECK"] = "TRUE" # Inside the manylinux container, the python installations are located in # special places... environ["PYTHON"] = "/opt/python/{}/bin/python".format( @@ -201,6 +202,10 @@ def build_jobspec(self, inner_jobs=None): environ["GRPC_SKIP_PIP_CYTHON_UPGRADE"] = "TRUE" environ["GRPC_RUN_AUDITWHEEL_REPAIR"] = "TRUE" environ["GRPC_PYTHON_BUILD_WITH_STATIC_LIBSTDCXX"] = "TRUE" + + if self.arch == "x86": + environ["GRPC_SKIP_TWINE_CHECK"] = "TRUE" + return create_docker_jobspec( self.name, "tools/dockerfile/grpc_artifact_python_%s_%s" @@ -401,15 +406,17 @@ def targets(): PythonArtifact("manylinux2014", "x64", "cp39-cp39", presubmit=True), PythonArtifact("manylinux2014", "x64", "cp310-cp310"), PythonArtifact("manylinux2014", "x64", "cp311-cp311"), + PythonArtifact("manylinux2014", "x64", "cp312-cp312"), PythonArtifact( - "manylinux2014", "x64", "cp312-cp312", presubmit=True + "manylinux2014", "x64", "cp313-cp313", presubmit=True ), PythonArtifact("manylinux2014", "x86", "cp38-cp38", presubmit=True), PythonArtifact("manylinux2014", "x86", "cp39-cp39", presubmit=True), PythonArtifact("manylinux2014", "x86", "cp310-cp310"), PythonArtifact("manylinux2014", "x86", "cp311-cp311"), + PythonArtifact("manylinux2014", "x86", "cp312-cp312"), PythonArtifact( - "manylinux2014", "x86", "cp312-cp312", presubmit=True + "manylinux2014", "x86", "cp313-cp313", presubmit=True ), PythonArtifact( "manylinux2014", "aarch64", "cp38-cp38", presubmit=True @@ -417,45 +424,52 @@ def targets(): PythonArtifact("manylinux2014", "aarch64", "cp39-cp39"), PythonArtifact("manylinux2014", "aarch64", "cp310-cp310"), PythonArtifact("manylinux2014", "aarch64", "cp311-cp311"), + PythonArtifact("manylinux2014", "aarch64", "cp312-cp312"), PythonArtifact( - "manylinux2014", "aarch64", "cp312-cp312", presubmit=True + "manylinux2014", "aarch64", "cp313-cp313", presubmit=True ), PythonArtifact("linux_extra", "armv7", "cp38-cp38", presubmit=True), PythonArtifact("linux_extra", "armv7", "cp39-cp39"), PythonArtifact("linux_extra", "armv7", "cp310-cp310"), PythonArtifact("linux_extra", "armv7", "cp311-cp311"), + PythonArtifact("linux_extra", "armv7", "cp312-cp312"), PythonArtifact( - "linux_extra", "armv7", "cp312-cp312", presubmit=True + "linux_extra", "armv7", "cp313-cp313", presubmit=True ), PythonArtifact("musllinux_1_1", "x64", "cp38-cp38", presubmit=True), PythonArtifact("musllinux_1_1", "x64", "cp39-cp39"), PythonArtifact("musllinux_1_1", "x64", "cp310-cp310"), PythonArtifact("musllinux_1_1", "x64", "cp311-cp311"), + PythonArtifact("musllinux_1_1", "x64", "cp312-cp312"), PythonArtifact( - "musllinux_1_1", "x64", "cp312-cp312", presubmit=True + "musllinux_1_1", "x64", "cp313-cp313", presubmit=True ), PythonArtifact("musllinux_1_1", "x86", "cp38-cp38", presubmit=True), PythonArtifact("musllinux_1_1", "x86", "cp39-cp39"), PythonArtifact("musllinux_1_1", "x86", "cp310-cp310"), PythonArtifact("musllinux_1_1", "x86", "cp311-cp311"), + PythonArtifact("musllinux_1_1", "x86", "cp312-cp312"), PythonArtifact( - "musllinux_1_1", "x86", "cp312-cp312", presubmit=True + "musllinux_1_1", "x86", "cp313-cp313", presubmit=True ), PythonArtifact("macos", "x64", "python3.8", presubmit=True), PythonArtifact("macos", "x64", "python3.9"), PythonArtifact("macos", "x64", "python3.10"), PythonArtifact("macos", "x64", "python3.11"), - PythonArtifact("macos", "x64", "python3.12", presubmit=True), + PythonArtifact("macos", "x64", "python3.12"), + PythonArtifact("macos", "x64", "python3.13", presubmit=True), PythonArtifact("windows", "x86", "Python38_32bit", presubmit=True), PythonArtifact("windows", "x86", "Python39_32bit"), PythonArtifact("windows", "x86", "Python310_32bit"), PythonArtifact("windows", "x86", "Python311_32bit"), - PythonArtifact("windows", "x86", "Python312_32bit", presubmit=True), + PythonArtifact("windows", "x86", "Python312_32bit"), + PythonArtifact("windows", "x86", "Python313_32bit", presubmit=True), PythonArtifact("windows", "x64", "Python38", presubmit=True), PythonArtifact("windows", "x64", "Python39"), PythonArtifact("windows", "x64", "Python310"), PythonArtifact("windows", "x64", "Python311"), - PythonArtifact("windows", "x64", "Python312", presubmit=True), + PythonArtifact("windows", "x64", "Python312"), + PythonArtifact("windows", "x64", "Python313", presubmit=True), RubyArtifact("linux", "x86-mingw32", presubmit=True), RubyArtifact("linux", "x64-mingw32", presubmit=True), RubyArtifact("linux", "x64-mingw-ucrt", presubmit=True), diff --git a/tools/run_tests/artifacts/build_artifact_python.bat b/tools/run_tests/artifacts/build_artifact_python.bat index ee17381bc1b68d..4ac49183af4e74 100644 --- a/tools/run_tests/artifacts/build_artifact_python.bat +++ b/tools/run_tests/artifacts/build_artifact_python.bat @@ -56,7 +56,7 @@ python setup.py bdist_wheel || goto :error popd @rem Ensure the generate artifacts are valid. -python -m pip install packaging==21.3 twine==3.8.0 +python -m pip install packaging==21.3 twine==5.0.0 python -m twine check dist\* tools\distrib\python\grpcio_tools\dist\* || goto :error xcopy /Y /I /S dist\* %ARTIFACT_DIR% || goto :error diff --git a/tools/run_tests/artifacts/build_artifact_python.sh b/tools/run_tests/artifacts/build_artifact_python.sh index 1598d2edc183c5..b00ae1e372c426 100755 --- a/tools/run_tests/artifacts/build_artifact_python.sh +++ b/tools/run_tests/artifacts/build_artifact_python.sh @@ -39,7 +39,7 @@ then # Any installation step is a potential source of breakages, # so we are trying to perform as few download-and-install operations # as possible. - "${PYTHON}" -m pip install --upgrade 'cython<3.0.0rc1' + "${PYTHON}" -m pip install --upgrade 'cython<4.0.0rc1' fi # Allow build_ext to build C/C++ files in parallel @@ -167,7 +167,8 @@ then "${PYTHON}" -m pip install virtualenv "${PYTHON}" -m virtualenv venv || { "${PYTHON}" -m pip install virtualenv==20.0.23 && "${PYTHON}" -m virtualenv venv; } # Ensure the generated artifacts are valid using "twine check" - venv/bin/python -m pip install "twine<=2.0" "readme_renderer<40.0" + # pinning twine's dependency package `cryptography` version to 3.3.2 (last version without Rust dependency) + venv/bin/python -m pip install "cryptography==3.3.2" "twine==5.0.0" "readme_renderer<40.0" venv/bin/python -m twine check dist/* tools/distrib/python/grpcio_tools/dist/* if [ "$GRPC_BUILD_MAC" == "" ]; then venv/bin/python -m twine check src/python/grpcio_observability/dist/* diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index 16f055338829e3..90073bb8e2c7ab 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -844,6 +844,13 @@ def _get_pythons(self, args): bits=bits, config_vars=config_vars, ) + python313_config = _python_config_generator( + name="py313", + major="3", + minor="13", + bits=bits, + config_vars=config_vars, + ) pypy27_config = _pypy_config_generator( name="pypy", major="2", config_vars=config_vars ) @@ -880,6 +887,8 @@ def _get_pythons(self, args): return (python311_config,) elif args.compiler == "python3.12": return (python312_config,) + elif args.compiler == "python3.13": + return (python313_config,) elif args.compiler == "pypy": return (pypy27_config,) elif args.compiler == "pypy3": @@ -893,6 +902,7 @@ def _get_pythons(self, args): python310_config, python311_config, python312_config, + python313_config, ) else: raise Exception("Compiler %s not supported." % args.compiler)