Skip to content

Commit 946dfc7

Browse files
genehwungtfx-copybara
authored andcommitted
TFDV update for OSS build.
PiperOrigin-RevId: 762730883
1 parent a6b4d3f commit 946dfc7

File tree

18 files changed

+1793
-178
lines changed

18 files changed

+1793
-178
lines changed

BUILD

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
load("@bazel_gazelle//:def.bzl", "gazelle")
2+
3+
package(
4+
default_visibility = [":__subpackages__"],
5+
)
6+
7+
licenses(["notice"])
8+
9+
exports_files(["LICENSE"])
10+
11+
gazelle(
12+
name = "gazelle-update-repos",
13+
args = [
14+
"-from_file=go.mod",
15+
"-to_macro=deps.bzl%go_dependencies",
16+
],
17+
command = "update-repos",
18+
)

RELEASE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
## Bug Fixes and Other Changes
2222

23-
* Relax dependency on Protobuf to include version 5.x
23+
* Relax dependency on Protobuf to include version 6.5
2424

2525
## Known Issues
2626

WORKSPACE

Lines changed: 195 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,55 @@ workspace(name = "tensorflow_data_validation")
22

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

5+
http_archive(
6+
name = "google_bazel_common",
7+
sha256 = "82a49fb27c01ad184db948747733159022f9464fc2e62da996fa700594d9ea42",
8+
strip_prefix = "bazel-common-2a6b6406e12208e02b2060df0631fb30919080f3",
9+
urls = ["https://github.com/google/bazel-common/archive/2a6b6406e12208e02b2060df0631fb30919080f3.zip"],
10+
)
11+
12+
################################################################################
13+
# Generic Bazel Support #
14+
################################################################################
15+
16+
http_archive(
17+
name = "rules_proto",
18+
sha256 = "6fb6767d1bef535310547e03247f7518b03487740c11b6c6adb7952033fe1295",
19+
strip_prefix = "rules_proto-6.0.2",
20+
url = "https://github.com/bazelbuild/rules_proto/releases/download/6.0.2/rules_proto-6.0.2.tar.gz",
21+
)
22+
23+
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies")
24+
25+
rules_proto_dependencies()
26+
27+
load("@rules_proto//proto:setup.bzl", "rules_proto_setup")
28+
29+
rules_proto_setup()
30+
31+
load("@rules_proto//proto:toolchains.bzl", "rules_proto_toolchains")
32+
33+
rules_proto_toolchains()
34+
535
# Install version 0.9.0 of rules_foreign_cc, as default version causes an
636
# invalid escape sequence error to be raised, which can't be avoided with
737
# the --incompatible_restrict_string_escapes=false flag (flag was removed in
838
# Bazel 5.0).
939
RULES_FOREIGN_CC_VERSION = "0.9.0"
40+
1041
http_archive(
1142
name = "rules_foreign_cc",
43+
patch_tool = "patch",
44+
patches = ["//third_party:rules_foreign_cc.patch"],
1245
sha256 = "2a4d07cd64b0719b39a7c12218a3e507672b82a97b98c6a89d38565894cf7c51",
1346
strip_prefix = "rules_foreign_cc-%s" % RULES_FOREIGN_CC_VERSION,
1447
url = "https://github.com/bazelbuild/rules_foreign_cc/archive/refs/tags/%s.tar.gz" % RULES_FOREIGN_CC_VERSION,
15-
patch_tool = "patch",
16-
patches = ["//third_party:rules_foreign_cc.patch",],
1748
)
1849

1950
load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")
20-
rules_foreign_cc_dependencies()
2151

22-
# To update package to a new revision, for example ABSL
23-
# 1. Update the 'COM_GOOGLE_ABSL_COMMIT' var below to include the new git hash.
24-
# 2. Get the sha256 hash of the archive with a command such as...
25-
# curl -L https://github.com/abseil/abseil-cpp/archive/<git hash>.tar.gz | sha256sum
26-
# and update the 'sha256' arg with the result.
27-
# 3. Request the new archive to be mirrored on mirror.bazel.build for more
28-
# reliable downloads.
52+
rules_foreign_cc_dependencies()
2953

30-
# TODO(caveness): Clean up dependencies that were needed by TF but are no longer
31-
# required.
32-
# Needed by tf_py_wrap_cc rule from Tensorflow.
33-
# When upgrading tensorflow version, also check tensorflow/WORKSPACE for the
34-
# version of this -- keep in sync.
3554
http_archive(
3655
name = "bazel_skylib",
3756
sha256 = "97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44",
@@ -41,77 +60,177 @@ http_archive(
4160
],
4261
)
4362

44-
# TensorFlow depends on "io_bazel_rules_closure" so we need this here.
45-
# Needs to be kept in sync with the same target in TensorFlow's WORKSPACE file.
46-
# LINT.IfChange(io_bazel_rules_clousure)
63+
_PROTOBUF_COMMIT = "4.25.6" # 4.25.6
64+
4765
http_archive(
48-
name = "io_bazel_rules_closure",
49-
sha256 = "5b00383d08dd71f28503736db0500b6fb4dda47489ff5fc6bed42557c07c6ba9",
50-
strip_prefix = "rules_closure-308b05b2419edb5c8ee0471b67a40403df940149",
66+
name = "com_google_protobuf",
67+
sha256 = "ff6e9c3db65f985461d200c96c771328b6186ee0b10bc7cb2bbc87cf02ebd864",
68+
strip_prefix = "protobuf-%s" % _PROTOBUF_COMMIT,
5169
urls = [
52-
"http://mirror.tensorflow.org/github.com/bazelbuild/rules_closure/archive/308b05b2419edb5c8ee0471b67a40403df940149.tar.gz",
53-
"https://github.com/bazelbuild/rules_closure/archive/308b05b2419edb5c8ee0471b67a40403df940149.tar.gz", # 2020-02-14
70+
"https://github.com/protocolbuffers/protobuf/archive/v4.25.6.zip",
5471
],
5572
)
56-
# LINT.ThenChange(:tf_commit)
5773

58-
# External proto rules.
74+
# Needed by abseil-py by zetasql.
5975
http_archive(
60-
name = "rules_proto",
61-
sha256 = "66bfdf8782796239d3875d37e7de19b1d94301e8972b3cbd2446b332429b4df1",
62-
strip_prefix = "rules_proto-4.0.0",
76+
name = "six_archive",
77+
build_file = "//third_party:six.BUILD",
78+
sha256 = "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a",
79+
strip_prefix = "six-1.10.0",
6380
urls = [
64-
"https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/refs/tags/4.0.0.tar.gz",
65-
"https://github.com/bazelbuild/rules_proto/archive/refs/tags/4.0.0.tar.gz",
81+
"http://mirror.bazel.build/pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz",
82+
"https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz",
6683
],
6784
)
68-
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
69-
rules_proto_dependencies()
70-
rules_proto_toolchains()
7185

72-
# TODO(b/239095455): Change to using a tfx-bsl workspace macro to load these
73-
# dependencies.
74-
# Needed by zetasql.
75-
_PROTOBUF_COMMIT = "3.21.9"
86+
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
87+
88+
protobuf_deps()
89+
90+
# Use the last commit on the relevant release branch to update.
91+
# LINT.IfChange(arrow_archive_version)
92+
ARROW_COMMIT = "347a88ff9d20e2a4061eec0b455b8ea1aa8335dc" # 6.0.1
93+
# LINT.ThenChange(third_party/arrow.BUILD:arrow_gen_version)
7694

95+
# `shasum -a 256` can be used to get `sha256` from the downloaded archive on
96+
# Linux.
7797
http_archive(
78-
name = "com_google_protobuf",
79-
sha256 = "f66073dee0bc159157b0bd7f502d7d1ee0bc76b3c1eac9836927511bdc4b3fc1",
80-
strip_prefix = "protobuf-%s" % _PROTOBUF_COMMIT,
98+
name = "arrow",
99+
build_file = "//third_party:arrow.BUILD",
100+
patches = ["//third_party:arrow.patch"],
101+
sha256 = "55fc466d0043c4cce0756bc18e1e62b3233be74c9afe8dc0d18420b9a5fd9714",
102+
strip_prefix = "arrow-%s" % ARROW_COMMIT,
103+
urls = ["https://github.com/apache/arrow/archive/%s.zip" % ARROW_COMMIT],
104+
)
105+
106+
COM_GOOGLE_ABSL_COMMIT = "4447c7562e3bc702ade25105912dce503f0c4010" # lts_2023_08_0
107+
108+
http_archive(
109+
name = "com_google_absl",
110+
sha256 = "df8b3e0da03567badd9440377810c39a38ab3346fa89df077bb52e68e4d61e74",
111+
strip_prefix = "abseil-cpp-%s" % COM_GOOGLE_ABSL_COMMIT,
112+
url = "https://github.com/abseil/abseil-cpp/archive/%s.tar.gz" % COM_GOOGLE_ABSL_COMMIT,
113+
)
114+
115+
# Will be loaded by workspace.bzl from head
116+
# TFMD_COMMIT = "404805761e614561cceedc429e67c357c62be26d" # 1.17.1
117+
118+
# http_archive(
119+
# name = "com_tensorflow_metadata",
120+
# sha256 = "1b72e0e5085812cd9b19e004a381b544542f9545a081f0f738c5ed6b8bb886a2",
121+
# strip_prefix = "metadata-%s" % TFMD_COMMIT,
122+
# urls = ["https://github.com/tensorflow/metadata/archive/%s.zip" % TFMD_COMMIT],
123+
# )
124+
125+
# TODO(b/177694034): Follow the new format for tensorflow import after TF 2.5.
126+
#here
127+
TENSORFLOW_COMMIT = "3c92ac03cab816044f7b18a86eb86aa01a294d95" # 2.17.1
128+
129+
http_archive(
130+
name = "org_tensorflow_no_deps",
131+
patches = [
132+
"//third_party:tensorflow_expose_example_proto.patch",
133+
],
134+
sha256 = "317dd95c4830a408b14f3e802698eb68d70d81c7c7cfcd3d28b0ba023fe84a68",
135+
strip_prefix = "tensorflow-%s" % TENSORFLOW_COMMIT,
81136
urls = [
82-
"https://github.com/protocolbuffers/protobuf/archive/v3.21.9.zip"
137+
"https://github.com/tensorflow/tensorflow/archive/%s.tar.gz" % TENSORFLOW_COMMIT,
83138
],
84139
)
85140

86-
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
87-
protobuf_deps()
141+
PYBIND11_COMMIT = "8a099e44b3d5f85b20f05828d919d2332a8de841" # 2.11.1
88142

89-
# Needed by abseil-py by zetasql.
90143
http_archive(
91-
name = "six_archive",
144+
name = "pybind11",
145+
build_file = "//third_party:pybind11.BUILD",
146+
sha256 = "8f4b7f28d214e36301435c055076c36186388dc9617117802cba8a059347cb00",
147+
strip_prefix = "pybind11-%s" % PYBIND11_COMMIT,
148+
urls = ["https://github.com/pybind/pybind11/archive/%s.zip" % PYBIND11_COMMIT],
149+
)
150+
151+
load("//third_party:python_configure.bzl", "local_python_configure")
152+
153+
local_python_configure(name = "local_config_python")
154+
155+
http_archive(
156+
name = "com_google_farmhash",
157+
build_file = "//third_party:farmhash.BUILD",
158+
sha256 = "6560547c63e4af82b0f202cb710ceabb3f21347a4b996db565a411da5b17aba0", # SHARED_FARMHASH_SHA
159+
strip_prefix = "farmhash-816a4ae622e964763ca0862d9dbd19324a1eaf45",
92160
urls = [
93-
"http://mirror.bazel.build/pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz",
94-
"https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz",
161+
"https://github.com/google/farmhash/archive/816a4ae622e964763ca0862d9dbd19324a1eaf45.tar.gz",
95162
],
96-
sha256 = "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a",
97-
strip_prefix = "six-1.10.0",
98-
build_file = "//third_party:six.BUILD"
99163
)
100164

101-
COM_GOOGLE_ABSL_COMMIT = "92fdbfb301f8b301b28ab5c99e7361e775c2fb8a" # 2022-08-25 Abseil Logging library first release
165+
################################################################################
166+
# Google APIs protos #
167+
################################################################################
168+
http_archive(
169+
name = "com_google_googleapis",
170+
patch_args = ["-p1"],
171+
patches = ["//third_party:googleapis.patch"],
172+
sha256 = "28e7fe3a640dd1f47622a4c263c40d5509c008cc20f97bd366076d5546cccb64",
173+
strip_prefix = "googleapis-4ce00b00904a7ce1df8c157e54fcbf96fda0dc49",
174+
url = "https://github.com/googleapis/googleapis/archive/4ce00b00904a7ce1df8c157e54fcbf96fda0dc49.tar.gz",
175+
)
176+
177+
load("@com_google_googleapis//:repository_rules.bzl", "switched_rules_by_language")
178+
179+
switched_rules_by_language(
180+
name = "com_google_googleapis_imports",
181+
cc = True,
182+
go = True,
183+
)
184+
185+
###############################################################################
186+
# Gazelle Support #
187+
###############################################################################
188+
189+
_rules_go_version = "v0.48.1"
190+
102191
http_archive(
103-
name = "com_google_absl",
104-
url = "https://github.com/abseil/abseil-cpp/archive/%s.tar.gz" % COM_GOOGLE_ABSL_COMMIT,
105-
sha256 = "71d38c5f44997a5ccbc338f904c8682b40c25cad60b9cbaf27087a917228d5fa",
106-
strip_prefix = "abseil-cpp-%s" % COM_GOOGLE_ABSL_COMMIT
192+
name = "io_bazel_rules_go",
193+
sha256 = "b2038e2de2cace18f032249cb4bb0048abf583a36369fa98f687af1b3f880b26",
194+
urls = [
195+
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/{0}/rules_go-{0}.zip".format(_rules_go_version),
196+
"https://github.com/bazelbuild/rules_go/releases/download/{0}/rules_go-{0}.zip.format(_rules_go_version)",
197+
],
107198
)
108199

109-
ZETASQL_COMMIT = "ac37cf5c0d80b5605176fc0f29e87b12f00be693" # 08/10/2022
200+
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
201+
202+
go_rules_dependencies()
203+
204+
go_register_toolchains(version = "1.21.11")
205+
206+
_bazel_gazelle_version = "0.36.0"
207+
208+
http_archive(
209+
name = "bazel_gazelle",
210+
sha256 = "75df288c4b31c81eb50f51e2e14f4763cb7548daae126817247064637fd9ea62",
211+
urls = [
212+
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v{0}/bazel-gazelle-v{0}.tar.gz".format(_bazel_gazelle_version),
213+
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v{0}/bazel-gazelle-v{0}.tar.gz".format(_bazel_gazelle_version),
214+
],
215+
)
216+
217+
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") #, "go_repository")
218+
219+
gazelle_dependencies()
220+
221+
################################################################################
222+
# ZetaSQL #
223+
################################################################################
224+
225+
ZETASQL_COMMIT = "a516c6b26d183efc4f56293256bba92e243b7a61" # 11/01/2024
226+
110227
http_archive(
111228
name = "com_google_zetasql",
112-
urls = ["https://github.com/google/zetasql/archive/%s.zip" % ZETASQL_COMMIT],
229+
patch_args = ["-p1"],
230+
patches = ["//third_party:zetasql.patch"],
231+
sha256 = "1afc2210d4aad371eff0a6bfdd8417ba99e02183a35dff167af2fa6097643f26",
113232
strip_prefix = "zetasql-%s" % ZETASQL_COMMIT,
114-
sha256 = "651a768cd51627f58aa6de7039aba9ddab22f4b0450521169800555269447840",
233+
urls = ["https://github.com/google/zetasql/archive/%s.tar.gz" % ZETASQL_COMMIT],
115234
)
116235

117236
load("@com_google_zetasql//bazel:zetasql_deps_step_1.bzl", "zetasql_deps_step_1")
@@ -123,45 +242,39 @@ load("@com_google_zetasql//bazel:zetasql_deps_step_2.bzl", "zetasql_deps_step_2"
123242
zetasql_deps_step_2(
124243
analyzer_deps = True,
125244
evaluator_deps = True,
126-
tools_deps = False,
127245
java_deps = False,
128246
testing_deps = False,
247+
tools_deps = False,
129248
)
130249

131-
# This is part of what zetasql_deps_step_3() does.
132-
load("@com_google_googleapis//:repository_rules.bzl", "switched_rules_by_language")
133-
switched_rules_by_language(
134-
name = "com_google_googleapis_imports",
135-
cc = True,
136-
)
250+
# No need to run zetasql_deps_step_3 and zetasql_deps_step_4 since all necessary dependencies are
251+
# already installed.
252+
253+
# load("@com_google_zetasql//bazel:zetasql_deps_step_3.bzl", "zetasql_deps_step_3")
254+
255+
# zetasql_deps_step_3()
256+
257+
# load("@com_google_zetasql//bazel:zetasql_deps_step_4.bzl", "zetasql_deps_step_4")
258+
259+
# zetasql_deps_step_4()
137260

138261
_PLATFORMS_VERSION = "0.0.6"
262+
139263
http_archive(
140264
name = "platforms",
265+
sha256 = "5308fc1d8865406a49427ba24a9ab53087f17f5266a7aabbfc28823f3916e1ca",
141266
urls = [
142267
"https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/%s/platforms-%s.tar.gz" % (_PLATFORMS_VERSION, _PLATFORMS_VERSION),
143268
"https://github.com/bazelbuild/platforms/releases/download/%s/platforms-%s.tar.gz" % (_PLATFORMS_VERSION, _PLATFORMS_VERSION),
144269
],
145-
sha256 = "5308fc1d8865406a49427ba24a9ab53087f17f5266a7aabbfc28823f3916e1ca",
146270
)
147271

272+
# Specify the minimum required bazel version.
273+
load("@bazel_skylib//lib:versions.bzl", "versions")
274+
275+
versions.check("6.5.0")
276+
148277
# Please add all new TensorFlow Data Validation dependencies in workspace.bzl.
149278
load("//tensorflow_data_validation:workspace.bzl", "tf_data_validation_workspace")
150279

151280
tf_data_validation_workspace()
152-
153-
load("@com_github_tfx_bsl//third_party:python_configure.bzl", "local_python_configure")
154-
local_python_configure(name = "local_config_python")
155-
156-
PYBIND11_COMMIT = "8a099e44b3d5f85b20f05828d919d2332a8de841" # 2.11.1
157-
http_archive(
158-
name = "pybind11",
159-
build_file = "@com_github_tfx_bsl//third_party:pybind11.BUILD",
160-
strip_prefix = "pybind11-%s" % PYBIND11_COMMIT,
161-
urls = ["https://github.com/pybind/pybind11/archive/%s.zip" % PYBIND11_COMMIT],
162-
sha256 = "8f4b7f28d214e36301435c055076c36186388dc9617117802cba8a059347cb00",
163-
)
164-
165-
# Specify the minimum required bazel version.
166-
load("@bazel_skylib//lib:versions.bzl", "versions")
167-
versions.check("6.1.0")

tensorflow_data_validation/BUILD

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ sh_binary(
3131
srcs = ["move_generated_files.sh"],
3232
data = select({
3333
"//conditions:default": [
34-
"//tensorflow_data_validation/anomalies/proto:custom_validation_config_pb2.py",
35-
"//tensorflow_data_validation/anomalies/proto:validation_config_pb2.py",
36-
"//tensorflow_data_validation/anomalies/proto:validation_metadata_pb2.py",
34+
"//tensorflow_data_validation/anomalies/proto:custom_validation_config_proto_py_pb2",
35+
"//tensorflow_data_validation/anomalies/proto:validation_config_proto_py_pb2",
36+
"//tensorflow_data_validation/anomalies/proto:validation_metadata_proto_py_pb2",
3737
"//tensorflow_data_validation/pywrap:tensorflow_data_validation_extension.so",
38-
"//tensorflow_data_validation/skew/protos:feature_skew_results_pb2.py",
38+
"//tensorflow_data_validation/skew/protos:feature_skew_results_proto_py_pb2",
3939
],
4040
}),
4141
)

0 commit comments

Comments
 (0)