Skip to content

Commit 336d690

Browse files
committed
Upgrade Struct2Tensor to TF 2.21.0 and Python 3.12/3.13
1 parent 84f85e1 commit 336d690

22 files changed

Lines changed: 158 additions & 68 deletions

.bazelrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,13 @@ build --protocopt=--experimental_allow_proto3_optional
1313
# parameter 'user_link_flags' is deprecated and will be removed soon.
1414
# It may be temporarily re-enabled by setting --incompatible_require_linker_input_cc_api=false
1515
build --incompatible_require_linker_input_cc_api=false
16+
17+
# Force use of protoc from com_google_protobuf
18+
build --proto_compiler=@com_google_protobuf//:protoc
19+
20+
# Add include path for Protobuf headers
21+
build --cxxopt="-Iexternal/com_google_protobuf/src"
22+
build --host_cxxopt="-Iexternal/com_google_protobuf/src"
23+
24+
# Disable Bzlmod to avoid conflicts with WORKSPACE
25+
common --noenable_bzlmod

.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6.5.0
1+
7.7.0

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
python-version: ["3.9", "3.10", "3.11"]
17+
python-version: ["3.10", "3.11", "3.12", "3.13"]
1818

1919
steps:
2020
- name: Checkout

.github/workflows/conda-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
fail-fast: false
1919
matrix:
2020
os: [ubuntu-latest, macos-latest]
21-
python-version: ["3.9", "3.10", "3.11"]
21+
python-version: ["3.10", "3.11", "3.12", "3.13"]
2222

2323
steps:
2424
- name: Checkout

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
python-version: ["3.9", "3.10", "3.11"]
17+
python-version: ["3.10", "3.11", "3.12", "3.13"]
1818

1919
steps:
2020
- name: Checkout

RELEASE.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,17 @@
44

55
## Major Features and Improvements
66

7+
* Upgraded to support TensorFlow 2.21.0.
8+
* Added support for Python 3.12 and 3.13.
9+
* Dropped support for Python 3.9.
10+
711
## Bug Fixes and Other Changes
812

13+
* Aligned Protobuf dependency to `>=6.0.0,<7.0.0`.
14+
* Updated PyArrow dependency to `>=14`.
15+
* Fixed C++ test build issues by defining missing `ASSERT_OK` and `EXPECT_OK` macros, replacing `LOG(FATAL)` with `abort()`, and fixing invalid Protobuf includes.
16+
* Fixed Python test failures by updating `assertRaisesRegex` to expect `RuntimeError` wrapping `ValueError` in Beam pipelines.
17+
918
## Known Issues
1019

1120
## Breaking Changes

WORKSPACE

Lines changed: 84 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,24 @@ workspace(name = "tensorflow_data_validation")
22

33
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
44

5+
_PROTOBUF_COMMIT = "6.31.1"
6+
7+
http_archive(
8+
name = "com_google_protobuf",
9+
sha256 = "6e09bbc950ba60c3a7b30280210cd285af8d7d8ed5e0a6ed101c72aff22e8d88",
10+
strip_prefix = "protobuf-%s" % _PROTOBUF_COMMIT,
11+
urls = [
12+
"https://github.com/protocolbuffers/protobuf/archive/refs/tags/v%s.zip" % _PROTOBUF_COMMIT,
13+
],
14+
patch_cmds = [
15+
"touch BUILD",
16+
],
17+
)
18+
19+
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
20+
21+
protobuf_deps()
22+
523
http_archive(
624
name = "zlib",
725
build_file = "@com_google_protobuf//:third_party/zlib.BUILD",
@@ -21,24 +39,24 @@ http_archive(
2139
# Generic Bazel Support #
2240
################################################################################
2341

24-
http_archive(
25-
name = "rules_proto",
26-
sha256 = "6fb6767d1bef535310547e03247f7518b03487740c11b6c6adb7952033fe1295",
27-
strip_prefix = "rules_proto-6.0.2",
28-
url = "https://github.com/bazelbuild/rules_proto/releases/download/6.0.2/rules_proto-6.0.2.tar.gz",
29-
)
30-
31-
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies")
32-
33-
rules_proto_dependencies()
34-
35-
load("@rules_proto//proto:setup.bzl", "rules_proto_setup")
36-
37-
rules_proto_setup()
38-
39-
load("@rules_proto//proto:toolchains.bzl", "rules_proto_toolchains")
40-
41-
rules_proto_toolchains()
42+
# http_archive(
43+
# name = "rules_proto",
44+
# sha256 = "6fb6767d1bef535310547e03247f7518b03487740c11b6c6adb7952033fe1295",
45+
# strip_prefix = "rules_proto-6.0.2",
46+
# url = "https://github.com/bazelbuild/rules_proto/releases/download/6.0.2/rules_proto-6.0.2.tar.gz",
47+
# )
48+
#
49+
# load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies")
50+
#
51+
# rules_proto_dependencies()
52+
#
53+
# load("@rules_proto//proto:setup.bzl", "rules_proto_setup")
54+
#
55+
# rules_proto_setup()
56+
#
57+
# load("@rules_proto//proto:toolchains.bzl", "rules_proto_toolchains")
58+
#
59+
# rules_proto_toolchains()
4260

4361
# Install version 0.9.0 of rules_foreign_cc, as default version causes an
4462
# invalid escape sequence error to be raised, which can't be avoided with
@@ -61,27 +79,29 @@ rules_foreign_cc_dependencies()
6179

6280
http_archive(
6381
name = "bazel_skylib",
64-
sha256 = "97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44",
82+
sha256 = "3b5b49006181f5f8ff626ef8ddceaa95e9bb8ad294f7b5d7b11ea9f7ddaf8c59",
6583
urls = [
66-
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz",
67-
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz",
84+
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.9.0/bazel-skylib-1.9.0.tar.gz",
85+
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.9.0/bazel-skylib-1.9.0.tar.gz",
6886
],
6987
)
7088

71-
_PROTOBUF_COMMIT = "4.25.6" # 4.25.6
72-
7389
http_archive(
74-
name = "com_google_protobuf",
75-
sha256 = "ff6e9c3db65f985461d200c96c771328b6186ee0b10bc7cb2bbc87cf02ebd864",
76-
strip_prefix = "protobuf-%s" % _PROTOBUF_COMMIT,
77-
urls = [
78-
"https://github.com/protocolbuffers/protobuf/archive/v4.25.6.zip",
79-
],
90+
name = "rules_python",
91+
sha256 = "c68bdc4fbec25de5b5493b8819cfc877c4ea299c0dcb15c244c5a00208cde311",
92+
strip_prefix = "rules_python-0.31.0",
93+
url = "https://github.com/bazelbuild/rules_python/releases/download/0.31.0/rules_python-0.31.0.tar.gz",
94+
)
95+
96+
load("@rules_python//python:repositories.bzl", "py_repositories")
97+
py_repositories()
98+
99+
local_repository(
100+
name = "compatibility_proxy",
101+
path = "third_party/dummy_compatibility_proxy",
80102
)
81103

82-
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
83104

84-
protobuf_deps()
85105

86106
# Use the last commit on the relevant release branch to update.
87107
# LINT.IfChange(arrow_archive_version)
@@ -101,9 +121,28 @@ http_archive(
101121

102122
http_archive(
103123
name = "com_google_absl",
104-
urls = ["https://github.com/abseil/abseil-cpp/archive/refs/tags/20230802.1.tar.gz"],
105-
strip_prefix = "abseil-cpp-20230802.1",
106-
sha256 = "987ce98f02eefbaf930d6e38ab16aa05737234d7afbab2d5c4ea7adbe50c28ed",
124+
urls = ["https://github.com/abseil/abseil-cpp/archive/refs/tags/20250127.2.tar.gz"],
125+
strip_prefix = "abseil-cpp-20250127.2",
126+
sha256 = "f5a67394128fb4d9a18124820026014591942d9c882d9055d4d2412b13bf1c91",
127+
patch_cmds = [
128+
"sed -i '/@rules_cc\\/\\/cc\\/compiler:emscripten/d' absl/debugging/BUILD.bazel",
129+
"sed -i '/@rules_cc\\/\\/cc\\/compiler:emscripten/d' absl/base/BUILD.bazel",
130+
"sed -i '/@rules_cc\\/\\/cc\\/compiler:emscripten/d' absl/random/internal/BUILD.bazel",
131+
"sed -i '/@rules_cc\\/\\/cc\\/compiler:emscripten/d' absl/synchronization/BUILD.bazel",
132+
],
133+
)
134+
135+
http_archive(
136+
name = "abseil-cpp",
137+
urls = ["https://github.com/abseil/abseil-cpp/archive/refs/tags/20250127.2.tar.gz"],
138+
strip_prefix = "abseil-cpp-20250127.2",
139+
sha256 = "f5a67394128fb4d9a18124820026014591942d9c882d9055d4d2412b13bf1c91",
140+
patch_cmds = [
141+
"sed -i '/@rules_cc\\/\\/cc\\/compiler:emscripten/d' absl/debugging/BUILD.bazel",
142+
"sed -i '/@rules_cc\\/\\/cc\\/compiler:emscripten/d' absl/base/BUILD.bazel",
143+
"sed -i '/@rules_cc\\/\\/cc\\/compiler:emscripten/d' absl/random/internal/BUILD.bazel",
144+
"sed -i '/@rules_cc\\/\\/cc\\/compiler:emscripten/d' absl/synchronization/BUILD.bazel",
145+
],
107146
)
108147

109148

@@ -128,14 +167,15 @@ http_archive(
128167

129168
# TODO(b/177694034): Follow the new format for tensorflow import after TF 2.5.
130169
#here
131-
TENSORFLOW_COMMIT = "3c92ac03cab816044f7b18a86eb86aa01a294d95" # 2.17.1
170+
# Corresponds to tag v2.21.0
171+
TENSORFLOW_COMMIT = "a481b10260dfdf833a1b16007eead49c1d7febf3"
132172

133173
http_archive(
134174
name = "org_tensorflow_no_deps",
135175
patches = [
136176
"//third_party:tensorflow_expose_example_proto.patch",
137177
],
138-
sha256 = "317dd95c4830a408b14f3e802698eb68d70d81c7c7cfcd3d28b0ba023fe84a68",
178+
sha256 = "ef3568bb4865d6c1b2564fb5689c19b6b9a5311572cd1f2ff9198636a8520921",
139179
strip_prefix = "tensorflow-%s" % TENSORFLOW_COMMIT,
140180
urls = [
141181
"https://github.com/tensorflow/tensorflow/archive/%s.tar.gz" % TENSORFLOW_COMMIT,
@@ -152,6 +192,13 @@ http_archive(
152192
urls = ["https://github.com/pybind/pybind11/archive/%s.zip" % PYBIND11_COMMIT],
153193
)
154194

195+
http_archive(
196+
name = "com_google_googletest",
197+
urls = ["https://github.com/google/googletest/archive/refs/tags/v1.14.0.tar.gz"],
198+
strip_prefix = "googletest-1.14.0",
199+
sha256 = "8ad598c73ad796e0d8280b082cebd82a630d73e73cd3c70057938a6501bba5d7",
200+
)
201+
155202
load("//third_party:python_configure.bzl", "local_python_configure")
156203

157204
local_python_configure(name = "local_config_python")
@@ -236,7 +283,7 @@ http_archive(
236283
# Specify the minimum required bazel version.
237284
load("@bazel_skylib//lib:versions.bzl", "versions")
238285

239-
versions.check("6.5.0")
286+
versions.check("7.7.0")
240287

241288
# Please add all new TensorFlow Data Validation dependencies in workspace.bzl.
242289
load("//tensorflow_data_validation:workspace.bzl", "tf_data_validation_workspace")

setup.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ class _BazelBuildCommand(setuptools.Command):
6464
file.
6565
"""
6666

67+
user_options = []
68+
6769
def initialize_options(self):
6870
pass
6971

@@ -179,9 +181,10 @@ def select_constraint(default, nightly=None, git_master=None):
179181
"Operating System :: POSIX :: Linux",
180182
"Programming Language :: Python",
181183
"Programming Language :: Python :: 3",
182-
"Programming Language :: Python :: 3.9",
183184
"Programming Language :: Python :: 3.10",
184185
"Programming Language :: Python :: 3.11",
186+
"Programming Language :: Python :: 3.12",
187+
"Programming Language :: Python :: 3.13",
185188
"Programming Language :: Python :: 3 :: Only",
186189
"Topic :: Scientific/Engineering",
187190
"Topic :: Scientific/Engineering :: Artificial Intelligence",
@@ -195,19 +198,17 @@ def select_constraint(default, nightly=None, git_master=None):
195198
# six, and protobuf) with TF.
196199
install_requires=[
197200
"absl-py>=0.9,<2.0.0",
198-
'apache-beam[gcp]>=2.53,<3;python_version>="3.11"',
199-
'apache-beam[gcp]>=2.50,<2.51;python_version<"3.11"',
201+
'apache-beam[gcp]>=2.53,<3',
200202
# TODO(b/139941423): Consider using multi-processing provided by
201203
# Beam's DirectRunner.
202204
"joblib>=1.2.0", # Dependency for multi-processing.
203205
"numpy>=1.22.0",
204206
"pandas>=1.0,<2",
205-
'protobuf>=4.25.2,<6.0.0;python_version>="3.11"',
206-
'protobuf>=4.21.6,<6.0.0;python_version<"3.11"',
207-
"pyarrow>=10,<11",
207+
'protobuf>=6.0.0,<7.0.0',
208+
"pyarrow>=14",
208209
"pyfarmhash>=0.2.2,<0.4",
209210
"six>=1.12,<2",
210-
"tensorflow>=2.17,<2.18",
211+
"tensorflow>=2.21,<2.22",
211212
"tensorflow-metadata"
212213
+ select_constraint(
213214
default=">=1.17.1,<1.18",
@@ -233,7 +234,7 @@ def select_constraint(default, nightly=None, git_master=None):
233234
],
234235
"all": _make_all_extra_requirements(),
235236
},
236-
python_requires=">=3.9,<4",
237+
python_requires=">=3.10,<4",
237238
packages=find_packages(),
238239
include_package_data=True,
239240
package_data={"": ["*.lib", "*.pyd", "*.so"]},

tensorflow_data_validation/BUILD

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,9 @@ sh_binary(
3838
],
3939
}),
4040
)
41+
42+
py_library(
43+
name = "tensorflow_data_validation",
44+
srcs = glob(["*.py"], exclude=["*_test.py"]),
45+
visibility = ["//visibility:public"],
46+
)

tensorflow_data_validation/anomalies/BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,6 @@ cc_library(
357357
deps = [
358358
":map_util",
359359
":path",
360-
"//third_party/tensorflow/tsl/platform:protobuf",
361360
"@com_github_tensorflow_metadata//tensorflow_metadata/proto/v0:metadata_v0_proto_cc_pb2",
362361
"@com_google_absl//absl/strings",
363362
"@com_google_absl//absl/types:optional",

0 commit comments

Comments
 (0)