Skip to content

Commit ae43579

Browse files
authored
rules_venv@0.3.0, rules_req_compile@1.0.0rc37 (#4255)
1 parent 27f8b13 commit ae43579

File tree

8 files changed

+320
-2
lines changed

8 files changed

+320
-2
lines changed
Lines changed: 220 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,220 @@
1+
"""rules_req_compile"""
2+
3+
module(
4+
name = "rules_req_compile",
5+
version = "1.0.0rc37",
6+
)
7+
8+
bazel_dep(name = "platforms", version = "0.0.11")
9+
bazel_dep(name = "rules_python", version = "1.2.0")
10+
bazel_dep(name = "bazel_skylib", version = "1.7.1")
11+
bazel_dep(name = "rules_cc", version = "0.1.1")
12+
13+
bazel_dep(name = "buildozer", version = "8.0.3", dev_dependency = True)
14+
bazel_dep(name = "buildifier_prebuilt", version = "8.0.3", dev_dependency = True)
15+
16+
python = use_extension("@rules_python//python/extensions:python.bzl", "python", dev_dependency = True)
17+
python.toolchain(
18+
configure_coverage_tool = True,
19+
# Working around a rules_python issue with docker
20+
# https://github.com/bazelbuild/rules_python/pull/713
21+
ignore_root_user_error = True,
22+
is_default = True,
23+
python_version = "3.11",
24+
)
25+
use_repo(
26+
python,
27+
"python_3_11_aarch64-apple-darwin",
28+
"python_3_11_aarch64-unknown-linux-gnu",
29+
"python_3_11_x86_64-apple-darwin",
30+
"python_3_11_x86_64-pc-windows-msvc",
31+
"python_3_11_x86_64-unknown-linux-gnu",
32+
python311 = "python_3_11",
33+
)
34+
35+
requirements = use_extension("//:extensions.bzl", "requirements")
36+
requirements.parse(
37+
name = "req_compile_deps",
38+
requirements_locks = {
39+
"//3rdparty:requirements.linux_aarch64.txt": "@rules_req_compile//tools/constraints:linux_aarch_any",
40+
"//3rdparty:requirements.linux_x86_64.txt": "@rules_req_compile//tools/constraints:linux_x86_64",
41+
"//3rdparty:requirements.macos_aarch64.txt": "@rules_req_compile//tools/constraints:macos_aarch64",
42+
"//3rdparty:requirements.macos_x86_64.txt": "@rules_req_compile//tools/constraints:macos_x86_64",
43+
"//3rdparty:requirements.windows_x86_64.txt": "@rules_req_compile//tools/constraints:windows_x86_64",
44+
},
45+
)
46+
use_repo(requirements, "req_compile_deps")
47+
48+
sdist_deps = use_extension("//private:sdist.bzl", "sdist_deps")
49+
use_repo(
50+
sdist_deps,
51+
"req_compile_sdist_compiler__pip",
52+
"req_compile_sdist_compiler__setuptools",
53+
"req_compile_sdist_compiler__wheel",
54+
)
55+
56+
dev_requirements = use_extension("//extensions:python.bzl", "requirements", dev_dependency = True)
57+
dev_requirements.parse(
58+
name = "req_compile_test_sdist",
59+
# Required to compile sdists
60+
interpreter_linux_aarch64 = "@python_3_11_x86_64-unknown-linux-gnu//:python",
61+
interpreter_linux_x86_64 = "@python_3_11_x86_64-unknown-linux-gnu//:python",
62+
interpreter_macos_aarch64 = "@python_3_11_aarch64-apple-darwin//:python",
63+
interpreter_macos_x86_64 = "@python_3_11_x86_64-apple-darwin//:python",
64+
interpreter_windows = "@python_3_11_x86_64-pc-windows-msvc//:python",
65+
requirements_lock = "//private/tests/sdist:requirements.txt",
66+
)
67+
use_repo(dev_requirements, "req_compile_test_sdist", "req_compile_test_sdist__pyspark")
68+
dev_requirements.parse(
69+
name = "req_compile_test_simple",
70+
requirements_lock = "//private/tests/simple:requirements.txt",
71+
)
72+
use_repo(dev_requirements, "req_compile_test_simple")
73+
dev_requirements.parse(
74+
name = "req_compile_test_platlib",
75+
requirements_locks = {
76+
"//private/tests/platlib:requirements.linux.txt": "@platforms//os:linux",
77+
"//private/tests/platlib:requirements.macos.txt": "@platforms//os:macos",
78+
"//private/tests/platlib:requirements.windows.txt": "@platforms//os:windows",
79+
},
80+
)
81+
use_repo(dev_requirements, "req_compile_test_platlib")
82+
dev_requirements.parse(
83+
name = "req_compile_test_transitive_ins",
84+
requirements_lock = "//private/tests/transitive_ins:requirements.txt",
85+
)
86+
use_repo(dev_requirements, "req_compile_test_transitive_ins")
87+
dev_requirements.parse(
88+
name = "req_compile_test_pip_parse_compat_single_plat",
89+
requirements_lock = "//private/tests/pip_parse_compat:requirements.txt",
90+
)
91+
use_repo(dev_requirements, "req_compile_test_pip_parse_compat_single_plat")
92+
dev_requirements.parse(
93+
name = "req_compile_test_pip_parse_compat_multi_plat",
94+
requirements_locks = {
95+
"//private/tests/pip_parse_compat:requirements.linux.txt": "@platforms//os:linux",
96+
"//private/tests/pip_parse_compat:requirements.macos.txt": "@platforms//os:macos",
97+
"//private/tests/pip_parse_compat:requirements.windows.txt": "@platforms//os:windows",
98+
},
99+
)
100+
use_repo(dev_requirements, "req_compile_test_pip_parse_compat_multi_plat")
101+
dev_requirements.parse(
102+
name = "req_compile_test_annotations",
103+
requirements_locks = {
104+
"//private/tests/annotations:requirements.linux.txt": "@platforms//os:linux",
105+
"//private/tests/annotations:requirements.macos.txt": "@platforms//os:macos",
106+
"//private/tests/annotations:requirements.windows.txt": "@platforms//os:windows",
107+
},
108+
)
109+
use_repo(
110+
dev_requirements,
111+
"req_compile_test_annotations",
112+
"req_compile_test_annotations_linux__numpy",
113+
"req_compile_test_annotations_macos__numpy",
114+
"req_compile_test_annotations_windows__numpy",
115+
)
116+
dev_requirements.package_annotation(
117+
additive_build_file_content = """\
118+
load("@rules_cc//cc:defs.bzl", "cc_library")
119+
load("@rules_req_compile//:defs.bzl", "py_package_annotation_target")
120+
121+
_INCLUDE_DIR = "site-packages/numpy/core/include"
122+
123+
cc_library(
124+
name = "headers",
125+
hdrs = glob(["{}/**/*.h".format(_INCLUDE_DIR)]),
126+
includes = [_INCLUDE_DIR],
127+
)
128+
129+
py_package_annotation_target(
130+
name = "pkg.headers",
131+
target = ":headers",
132+
)
133+
""",
134+
copy_executables = {
135+
"site-packages/numpy/testing/setup.py": "site-packages/numpy/testing/setup.copy.py",
136+
},
137+
copy_files = {
138+
"site-packages/numpy-1.26.4.dist-info/entry_points.txt": "site-packages/numpy-1.26.4.dist-info/entry_points.copy.txt",
139+
},
140+
copy_srcs = {
141+
"site-packages/numpy/conftest.py": "site-packages/numpy/conftest.copy.py",
142+
},
143+
data = [":pkg.headers"],
144+
package = "numpy",
145+
patches = [
146+
"//private/tests/annotations:numpy.patch",
147+
],
148+
deps = [
149+
# Show that label dependencies can be added.
150+
"@rules_python//python/runfiles",
151+
],
152+
)
153+
154+
# Sphinx is known to have a circular dependency. The annotations here solve for that.
155+
dev_requirements.package_annotation(
156+
package = "sphinxcontrib-htmlhelp",
157+
deps = ["-sphinx"],
158+
)
159+
dev_requirements.package_annotation(
160+
package = "sphinxcontrib-applehelp",
161+
deps = ["-sphinx"],
162+
)
163+
dev_requirements.package_annotation(
164+
package = "sphinxcontrib-devhelp",
165+
deps = ["-sphinx"],
166+
)
167+
dev_requirements.package_annotation(
168+
package = "sphinxcontrib-jsmath",
169+
deps = ["-sphinx"],
170+
)
171+
dev_requirements.package_annotation(
172+
package = "sphinxcontrib-qthelp",
173+
deps = ["-sphinx"],
174+
)
175+
dev_requirements.package_annotation(
176+
deps_excludes = ["sphinx"],
177+
package = "sphinxcontrib-serializinghtml",
178+
)
179+
180+
find_links_test_repository = use_repo_rule("//private/tests/find_links:find_links_test_repo.bzl", "find_links_test_repository")
181+
182+
find_links_test_repository(
183+
name = "req_compile_find_links_test",
184+
build_file = "//private/tests/find_links:BUILD.find_links.bazel",
185+
dev_dependency = True,
186+
pyspark_wheel_data = "@req_compile_test_sdist__pyspark//:whl.json",
187+
requirements_in = "//private/tests/find_links:requirements.in",
188+
requirements_txt = "//private/tests/find_links:requirements.txt",
189+
# Needs to match `--find-links` in `//private/tests/find_links:requirements.in`
190+
wheeldir = "wheeldir",
191+
)
192+
193+
# Use a separate extension since the @req_compile_find_links_test is generated by an extension
194+
# that also depend upon //extensions:python.bzl
195+
find_links_requirements = use_extension("//private/tests/find_links:extension.bzl", "requirements", dev_dependency = True)
196+
find_links_requirements.parse(
197+
name = "req_compile_test_find_links",
198+
requirements_lock = "@req_compile_find_links_test//:requirements.txt",
199+
)
200+
use_repo(find_links_requirements, "req_compile_test_find_links")
201+
202+
dev_requirements.parse(
203+
name = "req_compile_test_cross_platform",
204+
requirements_locks = {
205+
"//private/tests/cross_platform:requirements.linux.txt": "@platforms//os:linux",
206+
"//private/tests/cross_platform:requirements.macos.txt": "@platforms//os:macos",
207+
"//private/tests/cross_platform:requirements.windows.txt": "@platforms//os:windows",
208+
},
209+
)
210+
use_repo(dev_requirements, "req_compile_test_cross_platform")
211+
212+
bazel_dep(name = "rules_go", version = "0.50.1", dev_dependency = True)
213+
214+
go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk", dev_dependency = True)
215+
go_sdk.download(version = "1.23.1")
216+
217+
bazel_dep(name = "gazelle", version = "0.40.0", dev_dependency = True)
218+
bazel_dep(name = "stardoc", version = "0.8.0", dev_dependency = True)
219+
bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.7.1", dev_dependency = True)
220+
bazel_dep(name = "protobuf", version = "29.2", dev_dependency = True)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
bcr_test_module:
2+
module_path: "private/examples/multiplatform_py_test"
3+
matrix:
4+
platform: ["macos_arm64", "ubuntu2004", "windows"]
5+
bazel: [7.x, 8.x]
6+
tasks:
7+
run_tests:
8+
name: "Run test module"
9+
platform: ${{ platform }}
10+
bazel: ${{ bazel }}
11+
test_targets:
12+
- "//..."
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"strip_prefix": "",
3+
"url": "https://github.com/periareon/req-compile/releases/download/1.0.0rc37/rules_req_compile-1.0.0rc37.tar.gz",
4+
"integrity": "sha256-Ke1Gp70umyaWZjtclgB4K23wzx1I/INpXpXhxf7jVmw="
5+
}

modules/rules_req_compile/metadata.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"versions": [
2121
"1.0.0rc29",
2222
"1.0.0rc34",
23-
"1.0.0rc35"
23+
"1.0.0rc35",
24+
"1.0.0rc37"
2425
],
2526
"yanked_versions": {}
2627
}

modules/rules_venv/0.3.0/MODULE.bazel

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
"""periareon/rules_venv"""
2+
3+
module(
4+
name = "rules_venv",
5+
version = "0.3.0",
6+
)
7+
8+
bazel_dep(name = "bazel_skylib", version = "1.7.1")
9+
bazel_dep(name = "platforms", version = "0.0.11")
10+
bazel_dep(name = "rules_cc", version = "0.1.1")
11+
bazel_dep(name = "rules_python", version = "1.3.0")
12+
13+
register_toolchains(
14+
"//python/venv/toolchain",
15+
)
16+
17+
bazel_dep(name = "rules_req_compile", version = "1.0.0rc35", dev_dependency = True)
18+
bazel_dep(name = "stardoc", version = "0.8.0", dev_dependency = True, repo_name = "io_bazel_stardoc")
19+
bazel_dep(name = "rules_rust_mdbook", version = "0.59.2", dev_dependency = True)
20+
bazel_dep(name = "rules_shell", version = "0.4.0", dev_dependency = True)
21+
22+
python = use_extension("@rules_python//python/extensions:python.bzl", "python", dev_dependency = True)
23+
python.toolchain(
24+
configure_coverage_tool = True,
25+
# Working around a rules_python issue with docker
26+
# https://github.com/bazelbuild/rules_python/pull/713
27+
ignore_root_user_error = True,
28+
is_default = True,
29+
python_version = "3.11",
30+
)
31+
use_repo(
32+
python,
33+
"python_3_11_aarch64-apple-darwin",
34+
"python_3_11_aarch64-unknown-linux-gnu",
35+
"python_3_11_x86_64-apple-darwin",
36+
"python_3_11_x86_64-pc-windows-msvc",
37+
"python_3_11_x86_64-unknown-linux-gnu",
38+
python311 = "python_3_11",
39+
)
40+
41+
requirements = use_extension("@rules_req_compile//extensions:python.bzl", "requirements", dev_dependency = True)
42+
requirements.parse(
43+
name = "pip_deps",
44+
requirements_locks = {
45+
"//python/3rdparty:requirements_linux_aarch64.txt": "@@//python/3rdparty:linux_aarch64",
46+
"//python/3rdparty:requirements_linux_x86_64.txt": "@@//python/3rdparty:linux_x86_64",
47+
"//python/3rdparty:requirements_macos_aarch64.txt": "@@//python/3rdparty:macos_aarch64",
48+
"//python/3rdparty:requirements_windows_x86_64.txt": "@@//python/3rdparty:windows_x86_64",
49+
},
50+
)
51+
use_repo(requirements, "pip_deps")
52+
53+
register_toolchains(
54+
"//python/black/toolchain",
55+
"//python/isort/toolchain",
56+
"//python/pylint/toolchain",
57+
"//python/mypy/toolchain",
58+
"//python/wheel/toolchain",
59+
dev_dependency = True,
60+
)
61+
62+
bazel_dep(name = "buildifier_prebuilt", version = "7.3.1", dev_dependency = True)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
bcr_test_module:
2+
module_path: "examples/binary_consumer"
3+
matrix:
4+
platform: ["macos_arm64", "ubuntu2004", "windows"]
5+
bazel: [7.x, 8.x]
6+
tasks:
7+
run_tests:
8+
name: "Run test module"
9+
platform: ${{ platform }}
10+
bazel: ${{ bazel }}
11+
test_targets:
12+
- "//..."

modules/rules_venv/0.3.0/source.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"strip_prefix": "",
3+
"url": "https://github.com/periareon/rules_venv/releases/download/0.3.0/rules_venv-0.3.0.tar.gz",
4+
"integrity": "sha256-ixJnCkFUE/xJBVvh5kTW4pDI03lwZVCtgsu+iUsW3gI="
5+
}

modules/rules_venv/metadata.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
],
2020
"versions": [
2121
"0.1.0",
22-
"0.2.0"
22+
"0.2.0",
23+
"0.3.0"
2324
],
2425
"yanked_versions": {}
2526
}

0 commit comments

Comments
 (0)