Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.x
9.x
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ bazel_dep(name = "another_module", version = "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 = "rules_go", version = "0.60.0", dev_dependency = True, repo_name = "io_bazel_rules_go")

internal_dev_deps = use_extension(
"//python/private:internal_dev_deps.bzl",
Expand Down
2 changes: 2 additions & 0 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ For more detailed information about configuring `rules_python`, see:
* [Configuring third-party dependencies (pip/PyPI)](./pypi/index)
* [API docs](api/index)

A [screen recording](https://www.youtube.com/watch?v=Xtuh-WipOnk) on configuring rules_python for beginners is also available.

## Including dependencies

The first step to using `rules_python` is to add the dependency to
Expand Down
2 changes: 1 addition & 1 deletion examples/bzlmod/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.x
9.x
28 changes: 0 additions & 28 deletions tests/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@rules_shell//shell:sh_test.bzl", "sh_test")
load("//:version.bzl", "BAZEL_VERSION")

package(default_visibility = ["//visibility:public"])

Expand All @@ -27,29 +25,3 @@ build_test(
"//python/entry_points:py_console_script_binary_bzl",
],
)

genrule(
name = "assert_bazelversion",
srcs = ["//:.bazelversion"],
outs = ["assert_bazelversion_test.sh"],
cmd = """\
set -o errexit -o nounset -o pipefail
current=$$(cat "$(execpath //:.bazelversion)")
cat > "$@" <<EOF
#!/usr/bin/env bash
set -o errexit -o nounset -o pipefail
if [[ \"$${{current}}\" != \"{expected}\" ]]; then
>&2 echo "ERROR: current bazel version '$${{current}}' is not the expected '{expected}'"
exit 1
fi
EOF
""".format(
expected = BAZEL_VERSION,
),
executable = True,
)

sh_test(
name = "assert_bazelversion_test",
srcs = [":assert_bazelversion_test.sh"],
)
5 changes: 4 additions & 1 deletion tests/integration/local_toolchains/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ py_test(
"//:py": "local",
},
# Make this test better respect pyenv
env_inherit = ["PYENV_VERSION"],
env_inherit = [
"PYENV_VERSION",
"PATH",
],
)

py_test(
Expand Down
9 changes: 7 additions & 2 deletions tests/integration/local_toolchains/local_runtime_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,20 @@ def test_python_from_path_used(self):
# that wouldn't be reflected when sub-shells are run later.
shell_path = shutil.which("python3")

if shell_path is None:
self.fail(
"which(python3) returned None.\n" + f"PATH={os.environ.get('PATH')}"
)

# We call the interpreter and print its executable because of
# things like pyenv: they install a shim that re-execs python.
# The shim is e.g. /home/user/.pyenv/shims/python3, which then
# runs e.g. /usr/bin/python3
with tempfile.TemporaryDirectory() as temp_dir:
file_path = os.path.join(temp_dir, "info.py")
with open(file_path, 'w') as f:
with open(file_path, "w") as f:
f.write(
"""
"""
import sys
print(sys.executable)
print(sys._base_executable)
Expand Down