Upgrade MLMD to align with TF 2.21.0 and Added Python 3.12/3.13 support#243
Open
vkarampudi wants to merge 7 commits into
Open
Upgrade MLMD to align with TF 2.21.0 and Added Python 3.12/3.13 support#243vkarampudi wants to merge 7 commits into
vkarampudi wants to merge 7 commits into
Conversation
…pendencies with Python 3.12 & 3.13 support
… 3.13 wheels build-system
…e macOS runner folder conflicts
…etup.py to prevent macOS folder conflicts
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.
This PR upgrades ML Metadata (MLMD) to support Bazel
7.7.0and Protobuf6.31.1(Python) /v31.1(C++ archive) to align with TensorFlow 2.21.0 specifications, expands compatibility to Python 3.12 & 3.13, deprecates and removes Python 3.9 support, and resolves various build system incompatibilities, dependency conflicts, and compilation errors encountered during the process.Key Changes
1. Bazel 7.7.0 and Protobuf v31.1 Core Upgrades
7.7.0inside.bazelversionandWORKSPACE.rules_java 7.10.0,platforms 0.0.10,com_google_absl 20250127 LTS) in theWORKSPACEto support the upgraded compiler toolchain.common --noenable_bzlmodto.bazelrcto enforce correct WORKSPACE resolution priority.2. Python 3.12 & 3.13 Support and Python 3.9 Drop
python_requires='>=3.10,<4'and added classifiers for Python 3.12 and 3.13."3.9"and matrix across["3.10", "3.11", "3.12", "3.13"].3. Linker Unresolved References and Target Collisions (Macro Refactoring)
.soshared libraries, and Bazel threw duplicate target errors.cc_grpc_libraryrule compiled withgrpc_only = Truedoes not export regular proto definitions, leading to symbol starvation. Compiling both under the same target name in the macro caused target collisions.ml_metadata_proto_libraryinside ml_metadata.bzl:cc_grpc_librarytarget toname + "_grpc"and explicitly linked it against@com_github_grpc_grpc//:grpc++.cc_proto_library(name + "_cc_proto") and the gRPC stubs library (name + "_grpc") into a unified parentcc_librarynamedname. This cleanly resolved all linker errors without requiring any changes to individualBUILDfiles.4. BoringSSL and gRPC Preprocessor Compatibility
X509_get_key_usagenot declared).WORKSPACE, which lacked modern API features.com_github_grpc_grpc) to stablev1.70.1inWORKSPACE.boringsslto modern stable commit16c8d3db1af20fcc04b5190b25242aadcb1fbb30inWORKSPACEwhich fully implements OpenSSL 1.1.0+ APIs.5. UPB Struct Naming Conflicts (Workspace inline Patches)
opt) due to structural and naming mismatches inupbgenerated files inside gRPC xDS Orca metrics and ALTS handshaker files.upbgenerated structures that conflicts with older generated mapping definitions.patch_cmdsinsideWORKSPACEto cleanly stub out these modules:ParseBackendMetricDatato immediately returnnullptr.alts_tsi_handshaker_result_createto immediately returnTSI_FAILED_PRECONDITION, completely bypassing upb naming conflicts.6. Strict Proto Sandboxing and Target Dependencies
any.proto,struct.proto, anddescriptor.proto) were missing or not declared.@com_google_protobuf//:cc_wkt_protosdependency tometadata_store_service_protoinside ml_metadata/proto/BUILD.any_proto,struct_proto,descriptor_proto,field_mask_proto,duration_proto,timestamp_proto) to thenative.proto_librarycopy rules inside theml_metadata_proto_library_gomacro inml_metadata.bzlto ensure Go/Gazelle sandboxed compiles resolve their imports.@com_google_protobuf//:protobufdirectly to C++ targetrecord_parsing_utilsin ml_metadata/util/BUILD to prevent compilation from falling back to host system headers under/usr/include/google/protobuf/.7. macOS Wheel Packaging Folder Collisions
error: could not create 'build': File exists.setuptools's default'build'output folder name on case-insensitive macOS systems.self.build_baseinsidesetup.py's_BuildCommandclass to a dedicated package-specific name ('build_mlmd_tmp'), completely bypassing the macOS collision.rm -rf build build_mlmd_tmp distright before building wheels inside the CI workflows.8. NumPy 2.0+ Solver Compatibility for Python 3.13
< 2.0releases compatible with Python 3.13. The environment configurations had hardcodednumpy>=1.23,<2.0constraints.numpy>=1.23,<2.0tonumpy>=1.23inside ci/environment.yml, ci/environment-macos.yml, and pyproject.toml. This allows Python 3.13 pipelines to cleanly resolve using modern NumPy 2.x+ while older environments continue to use stable 1.x versions.9. Synchronized Missing Release Notes
Version 1.17.1release.Version 1.17.1release notes block directly from the upstream git tagv1.17.1into RELEASE.md.Verification & Testing
1. Bazel C++ Unit Tests
All 16 out of 16 core C++ Bazel test suites compile, link, and pass successfully in optimization mode:
bazel test --compilation_mode=opt --define grpc_no_xds=true //ml_metadata/...16 pass(ExpectedUNIMPLEMENTEDfailures on internal-only ZetaSQL lineage filtering are gracefully skipped).2. Python Integration Tests
All 101 out of 101 Python integration tests compile and pass successfully under
pytestutilizing the newly packaged wheel:99 passed, 2 xfailed(100% success; identical to target specifications).3. Wheel Package Generation
Successfully compiled and repacked the optimized production wheel file:
dist/ml_metadata-1.18.0.dev0-cp312-cp312-linux_x86_64.whl3.3 MB