-
Notifications
You must be signed in to change notification settings - Fork 354
/
python.patch
131 lines (128 loc) · 3.97 KB
/
python.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
diff --git a/MODULE.bazel b/MODULE.bazel
index caf4f829d4..6a3ceb08e8 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -34,3 +34,35 @@ use_repo(
grpc_extra_deps_ext = use_extension("//bazel:grpc_extra_deps.bzl", "grpc_extra_deps_ext")
use_repo(grpc_extra_deps_ext, "com_google_googleapis_imports")
+
+bazel_dep(name = "rules_python", version = "0.29.0")
+
+PYTHON_VERSIONS = [
+ "3.8",
+ "3.9",
+ "3.10",
+ "3.11",
+ "3.12",
+]
+
+python = use_extension("@rules_python//python/extensions:python.bzl", "python")
+[
+ python.toolchain(
+ is_default = python_version == PYTHON_VERSIONS[-1],
+ python_version = python_version,
+ )
+ for python_version in PYTHON_VERSIONS
+]
+
+pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
+[
+ pip.parse(
+ hub_name = "grpc_python_dependencies",
+ python_version = python_version,
+ requirements_lock = "//:requirements.bazel.txt",
+ )
+ for python_version in PYTHON_VERSIONS
+]
+use_repo(pip, "grpc_python_dependencies")
+grpc_python_deps_ext = use_extension("//bazel:grpc_python_deps.bzl", "grpc_python_deps_ext")
+use_repo(grpc_python_deps_ext, "cython")
diff --git a/bazel/cython_library.bzl b/bazel/cython_library.bzl
index dc2ef7a890..fd2881ed8c 100644
--- a/bazel/cython_library.bzl
+++ b/bazel/cython_library.bzl
@@ -72,7 +72,7 @@ def pyx_library(name, deps = [], py_deps = [], srcs = [], **kwargs):
native.cc_binary(
name = shared_object_name,
srcs = [stem + ".cpp"],
- deps = deps + ["@local_config_python//:python_headers"],
+ deps = deps + ["@rules_python//python/cc:current_py_cc_headers"],
defines = defines,
linkshared = 1,
)
diff --git a/bazel/grpc_python_deps.bzl b/bazel/grpc_python_deps.bzl
index 39893eef6e..172933e062 100644
--- a/bazel/grpc_python_deps.bzl
+++ b/bazel/grpc_python_deps.bzl
@@ -16,6 +16,18 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@com_github_grpc_grpc//third_party/py:python_configure.bzl", "python_configure")
+# buildifier: disable=unnamed-macro
+def cython():
+ http_archive(
+ name = "cython",
+ build_file = "@com_github_grpc_grpc//third_party:cython.BUILD",
+ sha256 = "a2da56cc22be823acf49741b9aa3aa116d4f07fa8e8b35a3cb08b8447b37c607",
+ strip_prefix = "cython-0.29.35",
+ urls = [
+ "https://github.com/cython/cython/archive/0.29.35.tar.gz",
+ ],
+ )
+
# buildifier: disable=unnamed-macro
def grpc_python_deps():
"""Loads dependencies for gRPC Python."""
@@ -36,12 +48,6 @@ def grpc_python_deps():
)
if "cython" not in native.existing_rules():
- http_archive(
- name = "cython",
- build_file = "@com_github_grpc_grpc//third_party:cython.BUILD",
- sha256 = "a2da56cc22be823acf49741b9aa3aa116d4f07fa8e8b35a3cb08b8447b37c607",
- strip_prefix = "cython-0.29.35",
- urls = [
- "https://github.com/cython/cython/archive/0.29.35.tar.gz",
- ],
- )
+ cython()
+
+grpc_python_deps_ext = module_extension(implementation = lambda ctx: cython())
diff --git a/requirements.bazel.txt b/requirements.bazel.txt
index f2dbfd7af8..ea81395c14 100644
--- a/requirements.bazel.txt
+++ b/requirements.bazel.txt
@@ -1,17 +1,25 @@
# GRPC Python setup requirements
+cachetools==4.2.4
+certifi==2017.4.17
+chardet==3.0.4
coverage==4.5.4
cython==0.29.21
-protobuf>=3.5.0.post1, < 4.0dev
-wheel==0.36.2
+gevent==22.8.0
google-auth==1.24.0
+googleapis-common-protos==1.5.5
+greenlet==1.1.3.post0
+grpcio==1.56.2
+idna==2.7
oauth2client==4.1.0
+protobuf>=3.5.0.post1, < 4.0dev
+pyasn1==0.5.1
+pyasn1-modules==0.3.0
requests==2.25.1
+rsa==4.9
+setuptools==69.0.3
+six==1.16.0
urllib3==1.26.5
-chardet==3.0.4
-certifi==2017.4.17
-idna==2.7
-googleapis-common-protos==1.5.5
-gevent==22.08.0
-zope.event==4.5.0
-setuptools==44.1.1
+wheel==0.36.2
xds-protos==0.0.11
+zope-event==4.5.0
+zope-interface==6.1