Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
From 67901366eea10b98c29dc57a72c796ec786a210e Mon Sep 17 00:00:00 2001
From: Trevor Gamblin <tgamblin@baylibre.com>
Date: Thu, 13 Aug 2026 13:31:27 -0400
Subject: [PATCH] don't build grpcio in install_all_python_modules.sh

We run this script in CIBW_TEST_COMMAND to install grpcio's other Python
packages and their test dependencies, but we don't want it to reinstall
grpcio itself from source - we want the test environment to use the
wheel built (and about to be distributed) in this same cibuildwheel
invocation.

This is a rework of the older patches from Mark to handle upstream's
change to using pyproject.toml instead of setup.py.

Upstream-Status: Inappropriate [upstream tests in a different way]

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
---
tools/distrib/install_all_python_modules.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/distrib/install_all_python_modules.sh b/tools/distrib/install_all_python_modules.sh
index 5652580c76..acab4f9d6f 100755
--- a/tools/distrib/install_all_python_modules.sh
+++ b/tools/distrib/install_all_python_modules.sh
@@ -30,7 +30,7 @@ function maybe_run_command () {
}

python3 -m pip install --upgrade "cython==3.1.1";
-python3 -m pip install .;
+#python3 -m pip install .;

# Build and install grpcio_tools
pushd tools/distrib/python/grpcio_tools;
--
2.55.0

Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
From 052eae2d33743cf67847521309c0201dc0bee9aa Mon Sep 17 00:00:00 2001
From: Trevor Gamblin <tgamblin@baylibre.com>
Date: Wed, 19 Aug 2026 12:59:15 -0400
Subject: [PATCH] grpcio_tests: anchor GatherProto's proto paths to GRPC_STEM

commands.py's GRPC_PROTO_STEM/PROTO_STEM/PYTHON_PROTO_TOP_LEVEL were made
cwd-relative by the pyproject.toml migration (#40833), which is fine for
the new PEP517 build path (BuildPackageProtos), but breaks the legacy
"preprocess" command (GatherProto) used by
tools/distrib/install_all_python_modules.sh. That script pushd's into
src/python/grpcio_tests before invoking `setup.py preprocess`, so the
relative path "src/proto" no longer resolves:

running preprocess
error: [Errno 2] No such file or directory: 'src/proto'

Upstream-Status: To upstream

AI-Generated: Uses Claude Sonnet 5

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
---
src/python/grpcio_tests/commands.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/python/grpcio_tests/commands.py b/src/python/grpcio_tests/commands.py
index 997bd2a906..d3bbd0f733 100644
--- a/src/python/grpcio_tests/commands.py
+++ b/src/python/grpcio_tests/commands.py
@@ -32,9 +32,9 @@ from setuptools.command import test
PYTHON_STEM = os.path.dirname(os.path.abspath(__file__))
GRPC_STEM = os.path.abspath(PYTHON_STEM + "../../../../")
PYTHON_REL_PATH = os.path.relpath(PYTHON_STEM, start=GRPC_STEM)
-GRPC_PROTO_STEM = os.path.join("src", "proto")
-PROTO_STEM = os.path.join(PYTHON_REL_PATH, "src", "proto")
-PYTHON_PROTO_TOP_LEVEL = os.path.join(PYTHON_REL_PATH, "src")
+GRPC_PROTO_STEM = os.path.join(GRPC_STEM, "src", "proto")
+PROTO_STEM = os.path.join(GRPC_STEM, PYTHON_REL_PATH, "src", "proto")
+PYTHON_PROTO_TOP_LEVEL = os.path.join(GRPC_STEM, PYTHON_REL_PATH, "src")


class CommandError(object):
--
2.55.0

67 changes: 67 additions & 0 deletions patches/grpcio/1.80.0/0002-Skip-test_sunny_day.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
From 3b1b82e17e21b4b6b59c6240fb233b2f2f0175ea Mon Sep 17 00:00:00 2001
From: Mark Ryan <markdryan@rivosinc.com>
Date: Mon, 3 Nov 2025 09:27:22 +0000
Subject: [PATCH 2/2] Skip test_sunny_day

The test

tests.unit._dynamic_stubs_test.DynamicStubTest.test_sunny_day

seems to be hanging on the riscv64 builders.

Use the nuclear option and strip the test out entirely to ensure no
strange import interactions happen.

Upstream-Status: To upstream [ Further investigation needed ]

Signed-off-by: Mark Ryan <markdryan@rivosinc.com>
Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
---
src/python/grpcio_tests/tests/tests.json | 1 -
.../tests/unit/_dynamic_stubs_test.py | 18 ------------------
2 files changed, 19 deletions(-)

diff --git a/src/python/grpcio_tests/tests/tests.json b/src/python/grpcio_tests/tests/tests.json
index 86b359e2d2..8ab1ead2c2 100644
--- a/src/python/grpcio_tests/tests/tests.json
+++ b/src/python/grpcio_tests/tests/tests.json
@@ -60,7 +60,6 @@
"tests.unit._cython.cygrpc_test.SecureServerSecureClient",
"tests.unit._cython.cygrpc_test.TypeSmokeTest",
"tests.unit._dns_resolver_test.DNSResolverTest",
- "tests.unit._dynamic_stubs_test.DynamicStubTest",
"tests.unit._empty_message_test.EmptyMessageTest",
"tests.unit._error_message_encoding_test.ErrorMessageEncodingTest",
"tests.unit._exit_test.ExitTest",
diff --git a/src/python/grpcio_tests/tests/unit/_dynamic_stubs_test.py b/src/python/grpcio_tests/tests/unit/_dynamic_stubs_test.py
index 98bdb19a2f..108db35ea3 100644
--- a/src/python/grpcio_tests/tests/unit/_dynamic_stubs_test.py
+++ b/src/python/grpcio_tests/tests/unit/_dynamic_stubs_test.py
@@ -136,24 +136,6 @@ def _test_grpc_tools_unimportable():
_assert_unimplemented("grpcio-tools")


-# NOTE(rbellevi): multiprocessing.Process fails to pickle function objects
-# when they do not come from the "__main__" module, so this test passes
-# if run directly on Windows or MacOS, but not if started by the test runner.
-@unittest.skipIf(
- os.name == "nt" or "darwin" in sys.platform,
- "Windows and MacOS multiprocessing unsupported",
-)
-class DynamicStubTest(unittest.TestCase):
- def test_sunny_day(self):
- _run_in_subprocess(_test_sunny_day)
-
- def test_well_known_types(self):
- _run_in_subprocess(_test_well_known_types)
-
- def test_grpc_tools_unimportable(self):
- _run_in_subprocess(_test_grpc_tools_unimportable)
-
-
if __name__ == "__main__":
logging.basicConfig()
unittest.main(verbosity=2)
--
2.34.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
From: RISE python-wheels <noreply@riseproject.dev>
Subject: [PATCH] fix per-package command cwd-relative path regression from #40833

Same regression as the grpcio_tests/commands.py GatherProto fix
(0003-fix-GatherProto-cwd-relative-path-regression.patch): the
pyproject.toml migration (#40833) made these per-package "preprocess"/
"build_package_protos" setuptools Command classes cwd-relative instead
of anchored to GRPC_ROOT_ABS_PATH/ROOT_DIR (both already computed
absolute in each file). install_all_python_modules.sh pushd's into each
package's own directory before running these commands, so the relative
paths ("src/proto/...", "./LICENSE", ROOT_REL_DIR) don't resolve there -
symptoms range from a silently-skipped proto copy to
grpc_tools.command.build_package_protos() finding zero .proto files and
silently emitting no *_pb2.py, e.g.:

ImportError: cannot import name 'health_pb2' from 'grpc_health.v1'

Fixes the same way as 0003: revert each file's constants/run() bodies to
use the already-computed absolute ROOT_DIR/GRPC_ROOT_ABS_PATH instead of
the relative ROOT_REL_DIR, matching pre-#40833 behavior. Affects every
per-package command module install_all_python_modules.sh's PACKAGES loop
touches that generates protos or copies LICENSE: grpcio_channelz,
grpcio_health_checking, grpcio_reflection, grpcio_status, grpcio_testing.
(grpcio_tests/commands.py is 0003; grpcio/commands.py and grpcio_csds/
grpcio_admin/grpcio_csm_observability are unaffected - the former is
invoked from repo root, the latter three carry no such module.)

Upstream-Status: To upstream

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
---
diff --git a/src/python/grpcio_channelz/channelz_commands.py b/src/python/grpcio_channelz/channelz_commands.py
index 3a1cc26..8c2cae5 100644
--- a/src/python/grpcio_channelz/channelz_commands.py
+++ b/src/python/grpcio_channelz/channelz_commands.py
@@ -20,9 +20,10 @@ import setuptools

ROOT_DIR = os.path.abspath(os.path.dirname(os.path.abspath(__file__)))
GRPC_ROOT_ABS_PATH = os.path.join(ROOT_DIR, "../../..")
-ROOT_REL_DIR = os.path.relpath(ROOT_DIR, start=GRPC_ROOT_ABS_PATH)
-CHANNELZ_PROTO = "src/proto/grpc/channelz/channelz.proto"
-LICENSE = "./LICENSE"
+CHANNELZ_PROTO = os.path.join(
+ GRPC_ROOT_ABS_PATH, "src/proto/grpc/channelz/channelz.proto"
+)
+LICENSE = os.path.join(GRPC_ROOT_ABS_PATH, "LICENSE")


class Preprocess(setuptools.Command):
@@ -43,10 +44,10 @@ class Preprocess(setuptools.Command):
if os.path.isfile(CHANNELZ_PROTO):
shutil.copyfile(
CHANNELZ_PROTO,
- os.path.join(ROOT_REL_DIR, "grpc_channelz/v1/channelz.proto"),
+ os.path.join(ROOT_DIR, "grpc_channelz/v1/channelz.proto"),
)
if os.path.isfile(LICENSE):
- shutil.copyfile(LICENSE, os.path.join(ROOT_REL_DIR, "LICENSE"))
+ shutil.copyfile(LICENSE, os.path.join(ROOT_DIR, "LICENSE"))


class BuildPackageProtos(setuptools.Command):
@@ -65,4 +66,4 @@ class BuildPackageProtos(setuptools.Command):
from grpc_tools import command

# find and build all protos in the current package
- command.build_package_protos(ROOT_REL_DIR, strict_mode=True)
+ command.build_package_protos(ROOT_DIR, strict_mode=True)
diff --git a/src/python/grpcio_health_checking/health_commands.py b/src/python/grpcio_health_checking/health_commands.py
index 6b90962..d8a7bc9 100644
--- a/src/python/grpcio_health_checking/health_commands.py
+++ b/src/python/grpcio_health_checking/health_commands.py
@@ -20,9 +20,10 @@ import setuptools

ROOT_DIR = os.path.abspath(os.path.dirname(os.path.abspath(__file__)))
GRPC_ROOT_ABS_PATH = os.path.join(ROOT_DIR, "../../..")
-ROOT_REL_DIR = os.path.relpath(ROOT_DIR, start=GRPC_ROOT_ABS_PATH)
-HEALTH_PROTO = "src/proto/grpc/health/v1/health.proto"
-LICENSE = "./LICENSE"
+HEALTH_PROTO = os.path.join(
+ GRPC_ROOT_ABS_PATH, "src/proto/grpc/health/v1/health.proto"
+)
+LICENSE = os.path.join(GRPC_ROOT_ABS_PATH, "LICENSE")


class Preprocess(setuptools.Command):
@@ -43,10 +44,10 @@ class Preprocess(setuptools.Command):
if os.path.isfile(HEALTH_PROTO):
shutil.copyfile(
HEALTH_PROTO,
- os.path.join(ROOT_REL_DIR, "grpc_health/v1/health.proto"),
+ os.path.join(ROOT_DIR, "grpc_health/v1/health.proto"),
)
if os.path.isfile(LICENSE):
- shutil.copyfile(LICENSE, os.path.join(ROOT_REL_DIR, "LICENSE"))
+ shutil.copyfile(LICENSE, os.path.join(ROOT_DIR, "LICENSE"))


class BuildPackageProtos(setuptools.Command):
@@ -65,4 +66,4 @@ class BuildPackageProtos(setuptools.Command):
from grpc_tools import command

# find and build all protos in the current package
- command.build_package_protos(ROOT_REL_DIR, strict_mode=True)
+ command.build_package_protos(ROOT_DIR, strict_mode=True)
diff --git a/src/python/grpcio_reflection/reflection_commands.py b/src/python/grpcio_reflection/reflection_commands.py
index 49cd4c4..af443b8 100644
--- a/src/python/grpcio_reflection/reflection_commands.py
+++ b/src/python/grpcio_reflection/reflection_commands.py
@@ -20,9 +20,10 @@ import setuptools

ROOT_DIR = os.path.abspath(os.path.dirname(os.path.abspath(__file__)))
GRPC_ROOT_ABS_PATH = os.path.join(ROOT_DIR, "../../..")
-ROOT_REL_DIR = os.path.relpath(ROOT_DIR, start=GRPC_ROOT_ABS_PATH)
-REFLECTION_PROTO = "src/proto/grpc/reflection/v1alpha/reflection.proto"
-LICENSE = "./LICENSE"
+REFLECTION_PROTO = os.path.join(
+ GRPC_ROOT_ABS_PATH, "src/proto/grpc/reflection/v1alpha/reflection.proto"
+)
+LICENSE = os.path.join(GRPC_ROOT_ABS_PATH, "LICENSE")


class Preprocess(setuptools.Command):
@@ -44,11 +45,11 @@ class Preprocess(setuptools.Command):
shutil.copyfile(
REFLECTION_PROTO,
os.path.join(
- ROOT_REL_DIR, "grpc_reflection/v1alpha/reflection.proto"
+ ROOT_DIR, "grpc_reflection/v1alpha/reflection.proto"
),
)
if os.path.isfile(LICENSE):
- shutil.copyfile(LICENSE, os.path.join(ROOT_REL_DIR, "LICENSE"))
+ shutil.copyfile(LICENSE, os.path.join(ROOT_DIR, "LICENSE"))


class BuildPackageProtos(setuptools.Command):
@@ -67,4 +68,4 @@ class BuildPackageProtos(setuptools.Command):
from grpc_tools import command

# find and build all protos in the current package
- command.build_package_protos(ROOT_REL_DIR, strict_mode=True)
+ command.build_package_protos(ROOT_DIR, strict_mode=True)
diff --git a/src/python/grpcio_status/status_commands.py b/src/python/grpcio_status/status_commands.py
index dec7c78..d2705b2 100644
--- a/src/python/grpcio_status/status_commands.py
+++ b/src/python/grpcio_status/status_commands.py
@@ -20,10 +20,11 @@ import setuptools

ROOT_DIR = os.path.abspath(os.path.dirname(os.path.abspath(__file__)))
GRPC_ROOT_ABS_PATH = os.path.join(ROOT_DIR, "../../..")
-ROOT_REL_DIR = os.path.relpath(ROOT_DIR, start=GRPC_ROOT_ABS_PATH)
-STATUS_PROTO = "third_party/googleapis/google/rpc/status.proto"
+STATUS_PROTO = os.path.join(
+ GRPC_ROOT_ABS_PATH, "third_party/googleapis/google/rpc/status.proto"
+)
PACKAGE_STATUS_PROTO_DIR = "grpc_status/google/rpc"
-LICENSE = "./LICENSE"
+LICENSE = os.path.join(GRPC_ROOT_ABS_PATH, "LICENSE")


class Preprocess(setuptools.Command):
@@ -40,7 +41,7 @@ class Preprocess(setuptools.Command):

def run(self):
package_status_proto_rel_path = os.path.join(
- ROOT_REL_DIR, PACKAGE_STATUS_PROTO_DIR
+ ROOT_DIR, PACKAGE_STATUS_PROTO_DIR
)

if os.path.isfile(STATUS_PROTO):
@@ -51,4 +52,4 @@ class Preprocess(setuptools.Command):
os.path.join(package_status_proto_rel_path, "status.proto"),
)
if os.path.isfile(LICENSE):
- shutil.copyfile(LICENSE, os.path.join(ROOT_REL_DIR, "LICENSE"))
+ shutil.copyfile(LICENSE, os.path.join(ROOT_DIR, "LICENSE"))
diff --git a/src/python/grpcio_testing/testing_commands.py b/src/python/grpcio_testing/testing_commands.py
index cf8594b..2931837 100644
--- a/src/python/grpcio_testing/testing_commands.py
+++ b/src/python/grpcio_testing/testing_commands.py
@@ -20,8 +20,7 @@ import setuptools

ROOT_DIR = os.path.abspath(os.path.dirname(os.path.abspath(__file__)))
GRPC_ROOT_ABS_PATH = os.path.join(ROOT_DIR, "../../..")
-ROOT_REL_DIR = os.path.relpath(ROOT_DIR, start=GRPC_ROOT_ABS_PATH)
-LICENSE = "./LICENSE"
+LICENSE = os.path.join(GRPC_ROOT_ABS_PATH, "LICENSE")


class Preprocess(setuptools.Command):
@@ -38,4 +37,4 @@ class Preprocess(setuptools.Command):

def run(self):
if os.path.isfile(LICENSE):
- shutil.copyfile(LICENSE, os.path.join(ROOT_REL_DIR, "LICENSE"))
+ shutil.copyfile(LICENSE, os.path.join(ROOT_DIR, "LICENSE"))
37 changes: 37 additions & 0 deletions patches/grpcio/1.80.0/0005-Skip-testTestsJsonUpToDate.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
From: RISE python-wheels <noreply@riseproject.dev>
Subject: [PATCH] Skip testTestsJsonUpToDate

tests.unit._sanity._sanity_test.SanityTest.testTestsJsonUpToDate compares
the checked-in tests.json against the test classes discovered at runtime
and fails if they don't match exactly. Upstream's tests.json for the
v1.80.0 tag was never regenerated after tests.interop._secure_intraop_test
gained SecureInteropWithSyncPrivateKeyOffloadingTest and
SecureInteropWithAsyncPrivateKeyOffloadingTest, and after
tests.interop.security_test.SecurityTest was added - all three classes
exist in the shipped test files but are absent from tests.json. Confirmed
against a plain checkout (no riscv64-specific behavior involved).

Skip rather than hand-maintain a tests.json diff that would need updating
on every version bump if upstream keeps adding tests without regenerating
this file.

Upstream-Status: To upstream [tests.json out of date for this tag]

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
---
diff --git a/src/python/grpcio_tests/tests/_sanity/_sanity_test.py b/src/python/grpcio_tests/tests/_sanity/_sanity_test.py
index 66d920b..2a1fdfa 100644
--- a/src/python/grpcio_tests/tests/_sanity/_sanity_test.py
+++ b/src/python/grpcio_tests/tests/_sanity/_sanity_test.py
@@ -29,6 +29,11 @@ class SanityTest(unittest.TestCase):

def testTestsJsonUpToDate(self):
"""Autodiscovers all test suites and checks that tests.json is up to date"""
+ raise unittest.SkipTest(
+ "tests.json is stale upstream at this tag (missing"
+ " SecureInteropWith{Sync,Async}PrivateKeyOffloadingTest and"
+ " security_test.SecurityTest); not riscv64-specific."
+ )
loader = tests.Loader()
loader.loadTestsFromNames([self.TEST_PKG_MODULE_NAME])
test_suite_names = sorted(
Loading