-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor JAX wheel build rules to control the wheel filename and main…
…tain reproducible wheel content and filename results. This change is a part of the initiative to test the JAX wheels in the presubmit properly. The list of the changes: 1. JAX wheel build rule verifies that `--@local_config_cuda//cuda:include_cuda_libs=false` during the wheel build. There is a way to pass the restriction by providing `--@local_config_cuda//cuda:override_include_cuda_libs=true`. 2. The version suffix of the wheel in the build rule output depends on the environment variables. 3. Environment variables combinations for creating wheels with different versions: * `0.5.0-0` (snapshot, default build rule behavior): `--repo_env=ML_WHEEL_TYPE=snapshot` * `0.5.0` (release): `--repo_env=ML_WHEEL_TYPE=release` * `0.5.0.dev20250101` (nightly): `--repo_env=ML_WHEEL_TYPE=nightly --repo_env=ML_WHEEL_BUILD_DATE=20250101` * `0.5.0.dev20241122+677cd8ebf` (custom): `--repo_env=ML_WHEEL_TYPE=custom --repo_env=ML_WHEEL_BUILD_DATE=$(git show -s --format=%as HEAD) --repo_env=ML_WHEEL_GIT_HASH=$(git rev-parse HEAD)` * `0.5.0.dev20241122+677cd8ebfalpha` (custom): `--repo_env=ML_WHEEL_TYPE=custom --repo_env=ML_WHEEL_BUILD_DATE=$(git show -s --format=%as HEAD) --repo_env=ML_WHEEL_GIT_HASH=$(git rev-parse HEAD) --repo_env=ML_WHEEL_VERSION_SUFFIX=-alpha` PiperOrigin-RevId: 699315679
- Loading branch information
1 parent
70a5175
commit 1e94f4d
Showing
12 changed files
with
265 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Copyright 2025 The JAX Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
""" Repository rule to generate a file with JAX python wheel version. """ | ||
|
||
def _jax_python_wheel_version_repository_impl(repository_ctx): | ||
file_content = repository_ctx.read( | ||
repository_ctx.path(repository_ctx.attr.file_with_version), | ||
) | ||
version_line_start_index = file_content.find(repository_ctx.attr.version_key) | ||
version_line_end_index = version_line_start_index + file_content[version_line_start_index:].find("\n") | ||
repository_ctx.file( | ||
"wheel_version.bzl", | ||
file_content[version_line_start_index:version_line_end_index].replace( | ||
repository_ctx.attr.version_key, | ||
"WHEEL_VERSION", | ||
), | ||
) | ||
repository_ctx.file("BUILD", "") | ||
|
||
jax_python_wheel_version_repository = repository_rule( | ||
implementation = _jax_python_wheel_version_repository_impl, | ||
attrs = { | ||
"file_with_version": attr.label(mandatory = True, allow_single_file = True), | ||
"version_key": attr.string(mandatory = True), | ||
}, | ||
) |
Oops, something went wrong.