Upgrade Bzlmod dependencies and improve NumPy 2.0 casting compatibility#342
Open
copybara-service[bot] wants to merge 1 commit into
Open
Upgrade Bzlmod dependencies and improve NumPy 2.0 casting compatibility#342copybara-service[bot] wants to merge 1 commit into
copybara-service[bot] wants to merge 1 commit into
Conversation
This CL introduces several Bzlmod dependency upgrades and core runtime/toolchain improvements:
1. Bzlmod Dependency Alignments:
- Upgrade `@rules_python` from `1.0.0` to `2.0.1` and `@rules_cc` from `0.0.9` to `0.2.17` in both `MODULE.bazel` and `examples/MODULE.bazel` to align toolchains across common packages.
- Declare aspect-based dependencies (`rules_cc` and `grpc`) in `MODULE.bazel` to support standard Bzlmod proto loaders.
2. Robust, re-free NumPy 2.0 Casting Checks:
- Upstream standard warnings context manager and ValueError/TypeError exceptions catching inside `dtype_utils.py` to handle NumPy 2.0 casting overflow check differences (adopting NEP 50).
- Integrate a robust, `re`-free string version parser (`_parse_version_string`) using basic string splitting (`split('.')`) and digit extraction. This completely removes the regex `import re` dependency and safely handles pre-releases (e.g. `'2.0rc1'`), dev builds (e.g. `'2.0.0.dev0'`), and incomplete version strings without runtime crashes.
- Expose `structure` target visibility directly as public inside `common_libs/BUILD` to satisfy Bazel's strict dependencies checks for downstream consumers.
3. Encapsulate Dev Requirements Tooling:
- Move toolchain-dependent `compile_pip_requirements` targets and `@python` loads out of the root `workspace.BUILD.bazel` to a dedicated subpackage `tools/requirements/BUILD`.
- This completely prevents Bzlmod transitive loading and analysis failures for external downstream consumers, while fully preserving lock-file regeneration capabilities for developers.
- Export requirements lock files in `workspace.BUILD.bazel` via `exports_files` to resolve subpackage visibility rules.
PiperOrigin-RevId: 919044946
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.
Upgrade Bzlmod dependencies and improve NumPy 2.0 casting compatibility
This CL introduces several Bzlmod dependency upgrades and core runtime/toolchain improvements:
Bzlmod Dependency Alignments:
@rules_pythonfrom1.0.0to2.0.1and@rules_ccfrom0.0.9to0.2.17in bothMODULE.bazelandexamples/MODULE.bazelto align toolchains across common packages.rules_ccandgrpc) inMODULE.bazelto support standard Bzlmod proto loaders.Robust, re-free NumPy 2.0 Casting Checks:
dtype_utils.pyto handle NumPy 2.0 casting overflow check differences (adopting NEP 50).re-free string version parser (_parse_version_string) using basic string splitting (split('.')) and digit extraction. This completely removes the regeximport redependency and safely handles pre-releases (e.g.'2.0rc1'), dev builds (e.g.'2.0.0.dev0'), and incomplete version strings without runtime crashes.structuretarget visibility directly as public insidecommon_libs/BUILDto satisfy Bazel's strict dependencies checks for downstream consumers.Encapsulate Dev Requirements Tooling:
compile_pip_requirementstargets and@pythonloads out of the rootworkspace.BUILD.bazelto a dedicated subpackagetools/requirements/BUILD.workspace.BUILD.bazelviaexports_filesto resolve subpackage visibility rules.