build: Fix pre-commit hooks + run in CI#3073
build: Fix pre-commit hooks + run in CI#3073brandonchinn178 wants to merge 6 commits intobazel-contrib:mainfrom
Conversation
4462695 to
2beb2ad
Compare
|
@rickeylev Not sure why CI failed |
pre-commit hooks were failing on `main`; presumably some developer didn't have pre-commit hooks set up locally or committed with `--no-verify`, and since it's not validated in CI, it got merged. Runs all pre-commit hooks in CI + fixes issues. Removes the buildifier job from CI since it's now covered by the pre-commit job **Question**: `update-deleted-packages` is showing different results locally on Mac vs in GitHub Actions. Not sure why... --------- Co-authored-by: Brandon Chinn <brandon.chinn@snowflake.com>
2beb2ad to
e57908b
Compare
|
@rickeylev Can you help here? |
|
The RBE errors look familiar. I think we fixed those at head awhile back. I'd suggest updating to head and seeing how it goes. I'd press update myself, but don't see that in the ui; did you allow maintainers write access? |
e57908b to
ba44654
Compare
|
@rickeylev No, I don't think I can grant access after creating the PR. I've rebased and pushed again |
|
Could you please merge main and rerun pre-commit again? The commit 6f5f97ab01fbcaaa34e3d3e0b989e5fa14f55b98 (HEAD -> bchinn-pre-commit, upstream/bchinn-pre-commit)
Author: Ignas Anikevicius <240938+aignas@users.noreply.github.com>
Date: Sun Aug 17 16:47:59 2025 +0900
chore: run pre-commit
diff --git a/.bazelrc b/.bazelrc
index 1129b624..5f6182fc 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -4,8 +4,8 @@
# (Note, we cannot use `common --deleted_packages` because the bazel version command doesn't support it)
# To update these lines, execute
# `bazel run @rules_bazel_integration_test//tools:update_deleted_packages`
-build --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/patches,examples/bzlmod/py_proto_library,examples/bzlmod/py_proto_library/example.com/another_proto,examples/bzlmod/py_proto_library/example.com/proto,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,examples/py_proto_library/example.com/another_proto,examples/py_proto_library/example.com/proto,gazelle,gazelle/manifest,gazelle/manifest/generate,gazelle/manifest/hasher,gazelle/manifest/test,gazelle/modules_mapping,gazelle/python,gazelle/python/private,gazelle/pythonconfig,tests/integration/compile_pip_requirements,tests/integration/compile_pip_requirements_test_from_external_repo,tests/integration/custom_commands,tests/integration/ignore_root_user_error,tests/integration/ignore_root_user_error/submodule,tests/integration/local_toolchains,tests/integration/pip_parse,tests/integration/pip_parse/empty,tests/integration/py_cc_toolchain_registered,tests/modules/another_module,tests/modules/other,tests/modules/other/nspkg_delta,tests/modules/other/nspkg_gamma,tests/modules/other/nspkg_single,tests/modules/other/simple_v1,tests/modules/other/simple_v2,tests/modules/other/with_external_data,tests/whl_with_build_files/testdata,tests/whl_with_build_files/testdata/somepkg,tests/whl_with_build_files/testdata/somepkg-1.0.dist-info,tests/whl_with_build_files/testdata/somepkg/subpkg
-query --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/patches,examples/bzlmod/py_proto_library,examples/bzlmod/py_proto_library/example.com/another_proto,examples/bzlmod/py_proto_library/example.com/proto,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,examples/py_proto_library/example.com/another_proto,examples/py_proto_library/example.com/proto,gazelle,gazelle/manifest,gazelle/manifest/generate,gazelle/manifest/hasher,gazelle/manifest/test,gazelle/modules_mapping,gazelle/python,gazelle/python/private,gazelle/pythonconfig,tests/integration/compile_pip_requirements,tests/integration/compile_pip_requirements_test_from_external_repo,tests/integration/custom_commands,tests/integration/ignore_root_user_error,tests/integration/ignore_root_user_error/submodule,tests/integration/local_toolchains,tests/integration/pip_parse,tests/integration/pip_parse/empty,tests/integration/py_cc_toolchain_registered,tests/modules/another_module,tests/modules/other,tests/modules/other/nspkg_delta,tests/modules/other/nspkg_gamma,tests/modules/other/nspkg_single,tests/modules/other/simple_v1,tests/modules/other/simple_v2,tests/modules/other/with_external_data,tests/whl_with_build_files/testdata,tests/whl_with_build_files/testdata/somepkg,tests/whl_with_build_files/testdata/somepkg-1.0.dist-info,tests/whl_with_build_files/testdata/somepkg/subpkg
+build --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/patches,examples/bzlmod/py_proto_library,examples/bzlmod/py_proto_library/example.com/another_proto,examples/bzlmod/py_proto_library/example.com/proto,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,examples/py_proto_library/example.com/another_proto,examples/py_proto_library/example.com/proto,gazelle,gazelle/docs,gazelle/manifest,gazelle/manifest/generate,gazelle/manifest/hasher,gazelle/manifest/test,gazelle/modules_mapping,gazelle/python,gazelle/pythonconfig,gazelle/python/private,tests/integration/compile_pip_requirements,tests/integration/compile_pip_requirements_test_from_external_repo,tests/integration/custom_commands,tests/integration/ignore_root_user_error,tests/integration/ignore_root_user_error/submodule,tests/integration/local_toolchains,tests/integration/pip_parse,tests/integration/pip_parse/empty,tests/integration/py_cc_toolchain_registered,tests/modules/another_module,tests/modules/other,tests/modules/other/nspkg_delta,tests/modules/other/nspkg_gamma,tests/modules/other/nspkg_single,tests/modules/other/simple_v1,tests/modules/other/simple_v2,tests/modules/other/with_external_data,tests/whl_with_build_files/testdata,tests/whl_with_build_files/testdata/somepkg,tests/whl_with_build_files/testdata/somepkg-1.0.dist-info,tests/whl_with_build_files/testdata/somepkg/subpkg
+query --deleted_packages=examples/build_file_generation,examples/build_file_generation/random_number_generator,examples/bzlmod,examples/bzlmod_build_file_generation,examples/bzlmod_build_file_generation/other_module/other_module/pkg,examples/bzlmod_build_file_generation/runfiles,examples/bzlmod/entry_points,examples/bzlmod/entry_points/tests,examples/bzlmod/libs/my_lib,examples/bzlmod/other_module,examples/bzlmod/other_module/other_module/pkg,examples/bzlmod/patches,examples/bzlmod/py_proto_library,examples/bzlmod/py_proto_library/example.com/another_proto,examples/bzlmod/py_proto_library/example.com/proto,examples/bzlmod/runfiles,examples/bzlmod/tests,examples/bzlmod/tests/other_module,examples/bzlmod/whl_mods,examples/multi_python_versions/libs/my_lib,examples/multi_python_versions/requirements,examples/multi_python_versions/tests,examples/pip_parse,examples/pip_parse_vendored,examples/pip_repository_annotations,examples/py_proto_library,examples/py_proto_library/example.com/another_proto,examples/py_proto_library/example.com/proto,gazelle,gazelle/docs,gazelle/manifest,gazelle/manifest/generate,gazelle/manifest/hasher,gazelle
/manifest/test,gazelle/modules_mapping,gazelle/python,gazelle/pythonconfig,gazelle/python/private,tests/integration/compile_pip_requirements,tests/integration/compile_pip_requirements_test_from_external_repo,tests/integration/custom_commands,tests/integration/ignore_root_user_error,tests/integration/ignore_root_user_error/submodule,tests/integration/local_toolchains,tests/integration/pip_parse,tests/integration/pip_parse/empty,tests/integration/py_cc_toolchain_registered,tests/modules/another_module,tests/modules/other,tests/modules/other/nspkg_delta,tests/modules/other/nspkg_gamma,tests/modules/other/nspkg_single,tests/modules/other/simple_v1,tests/modules/other/simple_v2,tests/modules/other/with_external_data,tests/whl_with_build_files/testdata,tests/whl_with_build_files/testdata/somepkg,tests/whl_with_build_files/testdata/somepkg-1.0.dist-info,tests/whl_with_build_files/testdata/somepkg/subpkg
test --test_output=errors
diff --git a/gazelle/python/testdata/from_imports/import_nested_var/__init__.py b/gazelle/python/testdata/from_imports/import_nested_var/__init__.py
index 20eda530..d0f51c44 100644
--- a/gazelle/python/testdata/from_imports/import_nested_var/__init__.py
+++ b/gazelle/python/testdata/from_imports/import_nested_var/__init__.py
@@ -13,8 +13,4 @@
# limitations under the License.
# baz is a variable in foo/bar/baz.py
-from foo\
- .bar.\
- baz import (
- baz
- )
+from foo.bar.baz import baz
diff --git a/python/bin/repl_stub.py b/python/bin/repl_stub.py
index f5b7c0aa..d81d99b3 100644
--- a/python/bin/repl_stub.py
+++ b/python/bin/repl_stub.py
@@ -62,10 +62,7 @@ try:
elif "GNU readline" in readline.__doc__: # type: ignore
readline.parse_and_bind("tab: complete")
else:
- print(
- "Could not enable tab completion: "
- "unable to determine readline backend"
- )
+ print("Could not enable tab completion: unable to determine readline backend")
except ImportError:
print(
"Could not enable tab completion: "
diff --git a/tests/integration/local_toolchains/test.py b/tests/integration/local_toolchains/test.py
index 0a0d6bed..20b50496 100644
--- a/tests/integration/local_toolchains/test.py
+++ b/tests/integration/local_toolchains/test.py
@@ -22,9 +22,9 @@ class LocalToolchainTest(unittest.TestCase):
# 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 |
Head branch was pushed to by a user without write access
ba44654 to
67b803a
Compare
|
@aignas Done. Two issues:
|
67b803a to
3ef5ce9
Compare
gazelle/python/testdata/from_imports/import_nested_var/__init__.py
Outdated
Show resolved
Hide resolved
3ef5ce9 to
1737679
Compare
|
It could be that the |
|
I think that the following patch to our ruleset would make things deterministic: diff --git a/MODULE.bazel b/MODULE.bazel
index b0b31dd7..27ed43cc 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -165,6 +165,14 @@ bazel_dep(name = "stardoc", version = "0.7.2", repo_name = "io_bazel_stardoc")
# ===== DEV ONLY DEPS AND SETUP BELOW HERE =====
bazel_dep(name = "rules_bazel_integration_test", version = "0.27.0", dev_dependency = True)
+single_version_override(
+ module_name = "rules_bazel_integration_test",
+ version = "0.27.0",
+ patches = [
+ "//private:rules_bazel_integration_test.patch",
+ ],
+ patch_strip = 1,
+)
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)
diff --git a/private/rules_bazel_integration_test.patch b/private/rules_bazel_integration_test.patch
new file mode 100644
index 00000000..1898fc69
--- /dev/null
+++ b/private/rules_bazel_integration_test.patch
@@ -0,0 +1,10 @@
+diff --git a/tools/find_child_workspace_packages.sh b/tools/find_child_workspace_packages.sh
+index 2c00ccf..3af5d45 100755
+--- a/tools/find_child_workspace_packages.sh
++++ b/tools/find_child_workspace_packages.sh
+@@ -114,4 +114,4 @@ while IFS=$'\n' read -r line; do sorted_abs_path_pkgs+=("$line"); done < <(
+ # Strip the workspace_root prefix from the paths
+ pkgs=( "${sorted_abs_path_pkgs[@]#"${workspace_root}/"}")
+
+-print_by_line "${pkgs[@]}"
++print_by_line "${pkgs[@]}" | sort |
|
Found it: bazel_starlib added LC_ALL=C: cgrindel/bazel-starlib@a2d4e34 We need to bump the verison of rules_bazel_integration_test: bazel-contrib/rules_bazel_integration_test@2594201 |
eb41b01 to
b08c8c3
Compare
pre-commit hooks were failing on
main; presumably some developer didn't have pre-commit hooks set up locally or committed with--no-verify, and since it's not validated in CI, it got merged.Runs all pre-commit hooks in CI + fixes issues. Removes the buildifier job from CI since it's now covered by the pre-commit job
Question:
update-deleted-packagesis showing different results locally on Mac vs in GitHub Actions. Not sure why...