Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for rules_python >= 0.36.0 and Bazel 8.x #133

Merged
merged 10 commits into from
Jan 18, 2025
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
7.0.0
7.4.1
# The first line of this file is used by Bazelisk and Bazel to be sure
# the right version of Bazel is used to build and test this repo.
# This also defines which version is used on CI.
Expand Down
38 changes: 6 additions & 32 deletions .bcr/presubmit.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,17 @@
matrix:
platform:
- debian10
- ubuntu2004
- macos_arm64
bazel:
- 7.x
- 6.x
tasks:
verify_targets:
name: Verify build targets
platform: ${{ platform }}
bazel: ${{ bazel }}
build_targets:
- "@rules_pycross//pycross/..."
bcr_test_module:
module_path: e2e/bzlmod
module_path: e2e/uv/always_build
matrix:
bazel:
- 7.x
- 8.x
platform:
- debian10
- ubuntu2004
- macos_arm64
tasks:
run_test_module_bazel_6:
run_tests:
name: Run test module
bazel: ${{ bazel }}
platform: ${{ platform }}
bazel: 6.x
build_targets:
- "//..."
- "--"
- "-//lock_file/..."
test_targets:
- //...
- "--"
- "-//lock_file/..."
run_test_module_bazel_7:
name: Run test module
platform: ${{ platform }}
bazel: 7.x
build_targets:
- //...
test_targets:
- //...
10 changes: 5 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ jobs:
with:
bazelversions: |
[
"6.5.0",
"7.4.1"
"7.4.1",
"8.0.0"
]
folders: |
[
Expand All @@ -59,13 +59,13 @@ jobs:
exclude: |
[
{"os": "windows-latest"},
{"folder": "e2e/pdm/vendored_lock_file_bzlmod", "bazelversion": "6.5.0"},
{"folder": "e2e/pdm/vendored_lock_file_bzlmod", "bazelversion": "7.4.1"},
{"folder": "e2e/pdm/vendored_lock_file_bzlmod", "bzlmodEnabled": false},
{"folder": "e2e/pdm/vendored_lock_file_workspace", "bzlmodEnabled": true},
{"folder": "e2e/poetry/vendored_lock_file_bzlmod", "bazelversion": "6.5.0"},
{"folder": "e2e/poetry/vendored_lock_file_bzlmod", "bazelversion": "7.4.1"},
{"folder": "e2e/poetry/vendored_lock_file_bzlmod", "bzlmodEnabled": false},
{"folder": "e2e/poetry/vendored_lock_file_workspace", "bzlmodEnabled": true},
{"folder": "e2e/uv/vendored_lock_file_bzlmod", "bazelversion": "6.5.0"},
{"folder": "e2e/uv/vendored_lock_file_bzlmod", "bazelversion": "7.4.1"},
{"folder": "e2e/uv/vendored_lock_file_bzlmod", "bzlmodEnabled": false},
{"folder": "e2e/uv/vendored_lock_file_workspace", "bzlmodEnabled": true}
]
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [0.7.0]

### Added

- Updates to support Bazel 8.0
- uv translator updates

### Fixed

- Obtain default Python version for Python hub repo from `versions.bzl` file, falling back to `interpreters.bzl` for backwards compatibility. `DEFAULT_PYTHON_VERSION` was [removed](https://github.com/bazelbuild/rules_python/blob/6a04d3832e82fec0a7b0675e9964b360bc358554/CHANGELOG.md?plain=1#L211) from `interpreters.bzl` in rules_python version 1.0.0.
Expand Down
4 changes: 2 additions & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ module(
compatibility_level = 1,
)

bazel_dep(name = "aspect_bazel_lib", version = "1.38.1")
bazel_dep(name = "aspect_bazel_lib", version = "2.9.4")
bazel_dep(name = "bazel_features", version = "1.11.0")
bazel_dep(name = "bazel_skylib", version = "1.4.2")
bazel_dep(name = "platforms", version = "0.0.4")
bazel_dep(name = "rules_python", version = "0.29.0")
bazel_dep(name = "rules_python", version = "1.0.0")

bazel_dep(name = "buildifier_prebuilt", version = "6.1.2", dev_dependency = True)

Expand Down
23 changes: 22 additions & 1 deletion docs/rules.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions docs/workspace_rules.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions e2e/pdm/always_build/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
bazel_dep(name = "aspect_bazel_lib", version = "2.3.0")
bazel_dep(name = "aspect_bazel_lib", version = "2.9.4")
bazel_dep(name = "hermetic_cc_toolchain", version = "2.2.1")
bazel_dep(name = "rules_pycross", version = "0.0.0")
bazel_dep(name = "rules_pycross_e2e_shared", version = "0.0.0")
bazel_dep(name = "rules_python", version = "0.31.0")
bazel_dep(name = "rules_python", version = "1.0.0")

local_path_override(
module_name = "rules_pycross",
Expand Down
18 changes: 9 additions & 9 deletions e2e/pdm/always_build/WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# aspect_bazel_lib
http_archive(
name = "aspect_bazel_lib",
sha256 = "bda4a69fa50411b5feef473b423719d88992514d259dadba7d8218a1d02c7883",
strip_prefix = "bazel-lib-2.3.0",
url = "https://github.com/aspect-build/bazel-lib/releases/download/v2.3.0/bazel-lib-v2.3.0.tar.gz",
sha256 = "349aabd3c2b96caeda6181eb0ae1f14f2a1d9f3cd3c8b05d57f709ceb12e9fb3",
strip_prefix = "bazel-lib-2.9.4",
url = "https://github.com/bazel-contrib/bazel-lib/releases/download/v2.9.4/bazel-lib-v2.9.4.tar.gz",
)

load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies", "aspect_bazel_lib_register_toolchains")
Expand All @@ -17,9 +17,9 @@ aspect_bazel_lib_register_toolchains()
# rules_python
http_archive(
name = "rules_python",
sha256 = "c68bdc4fbec25de5b5493b8819cfc877c4ea299c0dcb15c244c5a00208cde311",
strip_prefix = "rules_python-0.31.0",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.31.0/rules_python-0.31.0.tar.gz",
sha256 = "4f7e2aa1eb9aa722d96498f5ef514f426c1f55161c3c9ae628c857a7128ceb07",
strip_prefix = "rules_python-1.0.0",
url = "https://github.com/bazelbuild/rules_python/releases/download/1.0.0/rules_python-1.0.0.tar.gz",
)

load("@rules_python//python:repositories.bzl", "py_repositories", "python_register_multi_toolchains")
Expand All @@ -38,8 +38,6 @@ python_register_multi_toolchains(
register_coverage_tool = True,
)

load("@python_versions//3.12.0:defs.bzl", python_interpreter = "interpreter")

# rules_pycross
local_repository(
name = "rules_pycross",
Expand All @@ -53,7 +51,9 @@ local_repository(

load("@rules_pycross//pycross:repositories.bzl", "rules_pycross_dependencies")

rules_pycross_dependencies(python_interpreter)
rules_pycross_dependencies(
python_interpreter_target = "@python_versions_3_12_0_host//:python",
)

load("@rules_pycross//pycross:workspace.bzl", "lock_repo_model_pdm", "pycross_lock_repo", "pycross_register_for_python_toolchains")

Expand Down
4 changes: 2 additions & 2 deletions e2e/pdm/build_wheel/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
bazel_dep(name = "aspect_bazel_lib", version = "2.3.0")
bazel_dep(name = "aspect_bazel_lib", version = "2.9.4")
bazel_dep(name = "hermetic_cc_toolchain", version = "2.2.1")
bazel_dep(name = "platforms", version = "0.0.8")
bazel_dep(name = "rules_cc", version = "0.0.9")
bazel_dep(name = "rules_pycross", version = "0.0.0")
bazel_dep(name = "rules_pycross_e2e_shared", version = "0.0.0")
bazel_dep(name = "rules_python", version = "0.31.0")
bazel_dep(name = "rules_python", version = "1.0.0")

local_path_override(
module_name = "rules_pycross",
Expand Down
Loading
Loading