Skip to content

Commit 084b877

Browse files
authored
(chore): Remove the extra indirection and bzlmod folder (#2022)
The `bzlmod` folder seems like unnecessary indirection now. It was perhaps useful as we developed bzlmod support, but we no longer need it and it makes navigating the repository more difficult.
1 parent e5a0164 commit 084b877

File tree

12 files changed

+43
-69
lines changed

12 files changed

+43
-69
lines changed

MODULE.bazel

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ bazel_dep(name = "platforms", version = "0.0.4")
1313
bazel_dep(name = "rules_proto", version = "6.0.0-rc1")
1414
bazel_dep(name = "protobuf", version = "24.4", repo_name = "com_google_protobuf")
1515

16-
internal_deps = use_extension("//python/private/bzlmod:internal_deps.bzl", "internal_deps")
16+
internal_deps = use_extension("//python/private:internal_deps.bzl", "internal_deps")
1717
use_repo(
1818
internal_deps,
1919
"pypi__build",
@@ -54,7 +54,7 @@ register_toolchains("@pythons_hub//:all")
5454
#####################
5555
# Install twine for our own runfiles wheel publishing and allow bzlmod users to use it.
5656

57-
pip = use_extension("//python/private/bzlmod:pip.bzl", "pip_internal")
57+
pip = use_extension("//python/private/pypi:pip.bzl", "pip_internal")
5858
pip.parse(
5959
hub_name = "rules_python_publish_deps",
6060
python_version = "3.11",
@@ -77,7 +77,7 @@ bazel_dep(name = "rules_go", version = "0.41.0", dev_dependency = True, repo_nam
7777
bazel_dep(name = "gazelle", version = "0.33.0", dev_dependency = True, repo_name = "bazel_gazelle")
7878

7979
dev_pip = use_extension(
80-
"//python/private/bzlmod:pip.bzl",
80+
"//python/private/pypi:pip.bzl",
8181
"pip_internal",
8282
dev_dependency = True,
8383
)

python/extensions/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ bzl_library(
2828
name = "pip_bzl",
2929
srcs = ["pip.bzl"],
3030
visibility = ["//:__subpackages__"],
31-
deps = ["//python/private/bzlmod:pip_bzl"],
31+
deps = ["//python/private/pypi:pip_bzl"],
3232
)
3333

3434
bzl_library(
3535
name = "python_bzl",
3636
srcs = ["python.bzl"],
3737
visibility = ["//:__subpackages__"],
3838
deps = [
39-
"//python/private/bzlmod:python_bzl",
39+
"//python/private:python_bzl",
4040
],
4141
)

python/extensions/pip.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414

1515
"pip module extension for use with bzlmod"
1616

17-
load("//python/private/bzlmod:pip.bzl", _pip = "pip")
17+
load("//python/private/pypi:pip.bzl", _pip = "pip")
1818

1919
pip = _pip

python/extensions/python.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414

1515
"Python toolchain module extensions for use with bzlmod"
1616

17-
load("//python/private/bzlmod:python.bzl", _python = "python")
17+
load("//python/private:python.bzl", _python = "python")
1818

1919
python = _python

python/private/BUILD.bazel

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ licenses(["notice"])
2929
filegroup(
3030
name = "distribution",
3131
srcs = glob(["**"]) + [
32-
"//python/private/bzlmod:distribution",
3332
"//python/private/common:distribution",
3433
"//python/private/proto:distribution",
3534
"//python/private/pypi:distribution",
@@ -128,6 +127,28 @@ bzl_library(
128127
srcs = ["normalize_name.bzl"],
129128
)
130129

130+
bzl_library(
131+
name = "python_bzl",
132+
srcs = ["python.bzl"],
133+
deps = [
134+
":pythons_hub_bzl",
135+
":toolchains_repo_bzl",
136+
":util_bzl",
137+
"//python:repositories_bzl",
138+
"@bazel_features//:features",
139+
],
140+
)
141+
142+
bzl_library(
143+
name = "pythons_hub_bzl",
144+
srcs = ["pythons_hub.bzl"],
145+
deps = [
146+
":full_version_bzl",
147+
":py_toolchain_suite_bzl",
148+
"//python:versions_bzl",
149+
],
150+
)
151+
131152
bzl_library(
132153
name = "py_cc_toolchain_bzl",
133154
srcs = [

python/private/bzlmod/BUILD.bazel

Lines changed: 0 additions & 55 deletions
This file was deleted.

python/private/bzlmod/internal_deps.bzl renamed to python/private/internal_deps.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"Python toolchain module extension for internal rule use"
1010

1111
load("@bazel_skylib//lib:modules.bzl", "modules")
12-
load("//python/private:internal_config_repo.bzl", "internal_config_repo")
1312
load("//python/private/pypi:deps.bzl", "pypi_deps")
13+
load(":internal_config_repo.bzl", "internal_config_repo")
1414

1515
def _internal_deps():
1616
internal_config_repo(name = "rules_python_internal")

python/private/pypi/BUILD.bazel

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ bzl_library(
5555
)
5656

5757
bzl_library(
58-
name = "bzlmod_bzl",
59-
srcs = ["bzlmod.bzl"],
58+
name = "extension_bzl",
59+
srcs = ["extension.bzl"],
6060
deps = [
6161
":attrs_bzl",
6262
":hub_repository_bzl",
@@ -190,6 +190,14 @@ bzl_library(
190190
],
191191
)
192192

193+
bzl_library(
194+
name = "pip_bzl",
195+
srcs = ["pip.bzl"],
196+
deps = [
197+
":extension_bzl",
198+
],
199+
)
200+
193201
bzl_library(
194202
name = "pip_compile_bzl",
195203
srcs = ["pip_compile.bzl"],
File renamed without changes.

python/private/bzlmod/pip.bzl renamed to python/private/pypi/pip.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
"pip module extensions for use with bzlmod."
1616

17-
load("//python/private/pypi:bzlmod.bzl", "pypi", "pypi_internal")
17+
load("//python/private/pypi:extension.bzl", "pypi", "pypi_internal")
1818

1919
pip = pypi
2020
pip_internal = pypi_internal

0 commit comments

Comments
 (0)