Migrate TensorBoard builds to Bzlmod on Bazel 7.7.0 - #7145
Open
psamanoelton wants to merge 4 commits into
Open
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This change migrates TensorBoard’s build to Bazel Modules (Bzlmod) while keeping Bazel pinned to 7.7.0.
The migration preserves compatibility with TensorFlow 2.21.0 and Protobuf 6.31.1, makes Bzlmod the only supported dependency-resolution mode, and adds a hermetic Bazel-side Python environment.
This is intentionally not a Bazel 8 upgrade.
Motivation
TensorBoard’s TensorFlow 2.21.0 release required several non-trivial dependency updates and compatibility workarounds. Continuing to manage the dependency graph primarily through
WORKSPACEmakes future upgrades difficult because versions and transitive dependencies are not resolved consistently.Moving the supported build to Bzlmod provides:
Main changes
Enable Bzlmod on Bazel 7.7.0
MODULE.bazelandMODULE.bazel.lock..bazelrc.--noenable_bzlmodbuilds as unsupported.Move core dependencies to modules
The module graph now directly manages:
bazel_skylib1.7.1rules_cc0.1.1rules_java8.6.1rules_python1.0.0aspect_rules_js2.1.0rules_webtesting0.4.1rules_web_testing_python0.4.1Migrating
rules_webtestingalso removes the old explicit setup forrules_go, Gazelle, legacyrules_python, Bazel Skylib, and browser repositories.Add a hermetic Python environment
PYTHONPATH, user-site packages, and virtualenv state fromleaking into Bazel tests.
behind a local module extension.
The pip-package smoke test continues to create its own isolated environment because it validates the produced TensorBoard wheel rather than Bazel targets.
Preserve TensorFlow 2.21 / Protobuf compatibility
rules_cc0.1.1, which includes the requiredcc_proto_librarycorrection.
All compatibility patches and their expected removal conditions are documented in
patches/README.md.Update Bzlmod runfiles handling
Bzlmod changes the runfiles layout for the root module and module-extension repositories.
The affected shell utilities now support the
_mainlayout, including:The wheel builder resolves module-extension repositories through Bazel’s
_repo_mappingfile. This allows vendored Bleach and Webencodings sources to work without hardcoding their canonical Bzlmod repository names.Keep a transitional
WORKSPACE.bzlmodSome dependencies cannot be migrated safely without substantially expanding the scope of this change.
WORKSPACE.bzlmodremains as a compatibility bridge for:rules_nodejs5.8.1,yarn_install, and concatjsrules_sassrules_rustand cargo-raze graphThe original
WORKSPACEremains for repository compatibility and external tooling, but it is not a supported build mode.Validation
The following workflows pass locally on Linux:
Additional validation included:
Scope and follow-up work
This PR intentionally does not include:
Known limitation
TensorBoard uses Bzlmod as its supported dependency-resolution entry point, but some dependencies are still provided by the transitional
WORKSPACE.bzlmod.Consequently, builds using
--noenable_workspaceare not supported yet and are expected to fail, currently beginning with the legacy Closure/Soy repository.Removing
WORKSPACE.bzlmodshould be handled as follow-up work alongside the Closure, Node/Yarn, Sass, and Rust migrations.