Skip to content

Commit

Permalink
test(examples): Drop hermetic Python toolchain
Browse files Browse the repository at this point in the history
Setting up the hermetic toolchains is superfluous noise in the examples. Also,
it requires maintaining which rules_python version we use there. Plus, loading
rules_python in the examples on top of the DWYU dependencies might hide problems
with the rules_python version DWYU depends on.
Given we never had any issue with supporting multiple Python versions, we believe
using the host interpreter in the examples is fine.
  • Loading branch information
martis42 committed Jan 26, 2025
1 parent 5b44536 commit f0ad863
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 45 deletions.
21 changes: 3 additions & 18 deletions examples/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,9 @@ local_path_override(
path = "../",
)

#
# One can use DWYU without the content below. The hermetic Python toolchain increases the reproducibility when
# executing the examples as integration test.
#

# Keep in sync with //examples/WORKSPACE
bazel_dep(name = "rules_python", version = "0.27.1", dev_dependency = True)

python = use_extension(
"@rules_python//python/extensions:python.bzl",
"python",
dev_dependency = True,
)
python.toolchain(python_version = "3.8")

#
# Support to make the examples work
#
##
## One can use DWYU without the content below. We simply need some further things so all examples work.
##

bazel_dep(name = "external_targets", dev_dependency = True)
local_path_override(
Expand Down
30 changes: 3 additions & 27 deletions examples/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,9 @@ load("@depend_on_what_you_use//:setup_step_2.bzl", "setup_step_2")

setup_step_2()

#
# One can use DWYU without the content below. The hermetic Python toolchain increases the reproducibility when
# executing the examples as integration test.
#

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")

# Keep in sync with //examples/MODULE.bazel
maybe(
http_archive,
name = "rules_python",
sha256 = "e85ae30de33625a63eca7fc40a94fea845e641888e52f32b6beea91e8b1b2793",
strip_prefix = "rules_python-0.27.1",
urls = ["https://github.com/bazelbuild/rules_python/releases/download/0.27.1/rules_python-0.27.1.tar.gz"],
)

load("@rules_python//python:repositories.bzl", "python_register_toolchains")

python_register_toolchains(
name = "python",
python_version = "3.8",
)

#
# Support to make the examples work
#
##
## One can use DWYU without the content below. We simply need some further things so all examples work.
##

load("//:support/external_targets.bzl", "load_external_targets")

Expand Down

0 comments on commit f0ad863

Please sign in to comment.