-
Notifications
You must be signed in to change notification settings - Fork 541
/
MODULE.bazel
173 lines (153 loc) · 5.58 KB
/
MODULE.bazel
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
module(
name = "rules_python",
version = "0.0.0",
compatibility_level = 1,
)
bazel_dep(name = "bazel_features", version = "1.9.1")
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "rules_cc", version = "0.0.9")
bazel_dep(name = "platforms", version = "0.0.4")
# Those are loaded only when using py_proto_library
bazel_dep(name = "rules_proto", version = "6.0.0-rc1")
bazel_dep(name = "protobuf", version = "24.4", repo_name = "com_google_protobuf")
internal_deps = use_extension("//python/private:internal_deps.bzl", "internal_deps")
use_repo(
internal_deps,
"pypi__build",
"pypi__click",
"pypi__colorama",
"pypi__importlib_metadata",
"pypi__installer",
"pypi__more_itertools",
"pypi__packaging",
"pypi__pep517",
"pypi__pip",
"pypi__pip_tools",
"pypi__pyproject_hooks",
"pypi__setuptools",
"pypi__tomli",
"pypi__wheel",
"pypi__zipp",
"rules_python_internal",
)
# We need to do another use_extension call to expose the "pythons_hub"
# repo.
python = use_extension("//python/extensions:python.bzl", "python")
# The default toolchain to use if nobody configures a toolchain.
# NOTE: This is not a stable version. It is provided for convenience, but will
# change frequently to track the most recent Python version.
# NOTE: The root module can override this.
python.toolchain(
is_default = True,
python_version = "3.11",
)
use_repo(python, "python_3_11", "python_versions", "pythons_hub")
# This call registers the Python toolchains.
register_toolchains("@pythons_hub//:all")
#####################
# Install twine for our own runfiles wheel publishing and allow bzlmod users to use it.
pip = use_extension("//python/private/pypi:pip.bzl", "pip_internal")
pip.parse(
# NOTE @aignas 2024-10-26: We have an integration test that depends on us
# being able to build sdists for this hub, so explicitly set this to False.
download_only = False,
experimental_index_url = "https://pypi.org/simple",
hub_name = "rules_python_publish_deps",
python_version = "3.11",
requirements_by_platform = {
"//tools/publish:requirements_darwin.txt": "osx_*",
"//tools/publish:requirements_linux.txt": "linux_*",
"//tools/publish:requirements_windows.txt": "windows_*",
},
)
use_repo(pip, "rules_python_publish_deps")
# Not a dev dependency to allow usage of //sphinxdocs code, which refers to stardoc repos.
bazel_dep(name = "stardoc", version = "0.6.2", repo_name = "io_bazel_stardoc")
# ===== DEV ONLY DEPS AND SETUP BELOW HERE =====
bazel_dep(name = "rules_bazel_integration_test", version = "0.26.1", dev_dependency = True)
bazel_dep(name = "rules_testing", version = "0.6.0", dev_dependency = True)
bazel_dep(name = "rules_shell", version = "0.3.0", dev_dependency = True)
bazel_dep(name = "rules_multirun", version = "0.9.0", dev_dependency = True)
bazel_dep(name = "bazel_ci_rules", version = "1.0.0", dev_dependency = True)
# Extra gazelle plugin deps so that WORKSPACE.bzlmod can continue including it for e2e tests.
# We use `WORKSPACE.bzlmod` because it is impossible to have dev-only local overrides.
bazel_dep(name = "rules_go", version = "0.41.0", dev_dependency = True, repo_name = "io_bazel_rules_go")
bazel_dep(name = "gazelle", version = "0.33.0", dev_dependency = True, repo_name = "bazel_gazelle")
bazel_dep(name = "rules_python_gazelle_plugin", version = "0", dev_dependency = True)
internal_dev_deps = use_extension(
"//python/private:internal_dev_deps.bzl",
"internal_dev_deps",
dev_dependency = True,
)
use_repo(internal_dev_deps, "buildkite_config", "wheel_for_testing")
# Add gazelle plugin so that we can run the gazelle example as an e2e integration
# test and include the distribution files.
local_path_override(
module_name = "rules_python_gazelle_plugin",
path = "gazelle",
)
dev_python = use_extension(
"//python/extensions:python.bzl",
"python",
dev_dependency = True,
)
dev_python.override(
register_all_versions = True,
)
dev_pip = use_extension(
"//python/extensions:pip.bzl",
"pip",
dev_dependency = True,
)
dev_pip.parse(
download_only = True,
experimental_index_url = "https://pypi.org/simple",
hub_name = "dev_pip",
python_version = "3.11",
requirements_lock = "//docs:requirements.txt",
)
dev_pip.parse(
download_only = True,
experimental_index_url = "https://pypi.org/simple",
hub_name = "pypiserver",
python_version = "3.11",
requirements_lock = "//examples/wheel:requirements_server.txt",
)
use_repo(dev_pip, "dev_pip", "pypiserver")
# Bazel integration test setup below
bazel_binaries = use_extension(
"@rules_bazel_integration_test//:extensions.bzl",
"bazel_binaries",
dev_dependency = True,
)
# Keep in sync with //:version.bzl
bazel_binaries.local(
name = "self",
path = "tests/integration/bazel_from_env",
)
bazel_binaries.download(version = "6.4.0")
bazel_binaries.download(version = "7.3.1")
bazel_binaries.download(version = "rolling")
use_repo(
bazel_binaries,
"bazel_binaries",
# These don't appear necessary, but are reported as direct dependencies
# that should be use_repo()'d, so we add them as requested
"bazel_binaries_bazelisk",
"build_bazel_bazel_6_4_0",
"build_bazel_bazel_7_3_1",
"build_bazel_bazel_rolling",
"build_bazel_bazel_self",
)
# EXPERIMENTAL: This is experimental and may be removed without notice
uv = use_extension(
"//python/uv:extensions.bzl",
"uv",
dev_dependency = True,
)
uv.toolchain(uv_version = "0.4.25")
use_repo(uv, "uv_toolchains")
register_toolchains(
"@uv_toolchains//:all",
dev_dependency = True,
)