Skip to content

Commit af8665b

Browse files
committed
Updating Tensorflow dependency to >=2.15,<3, bazel dependency to 6.1.0.
PiperOrigin-RevId: 596011489
1 parent bf824b7 commit af8665b

File tree

7 files changed

+602
-7
lines changed

7 files changed

+602
-7
lines changed

.bazelversion

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5.3.0
1+
6.1.0

RELEASE.md

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
* Bumped the Ubuntu version on which `struct2tensor` is tested to 20.04
1010
(previously was 16.04).
11+
* Depends on `tensorflow>=2.15.0,<3`.
12+
* Bumped the minimum bazel version required to build `struct2tensor` to 6.1.0.
1113

1214
## Breaking Changes
1315

WORKSPACE

+10-5
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ tf_configure(name = "local_config_tf")
4141
# 3. Request the new archive to be mirrored on mirror.bazel.build for more
4242
# reliable downloads.
4343

44-
_TENSORFLOW_GIT_COMMIT = "1cb1a030a62b169d90d34c747ab9b09f332bf905" # tf 2.13.0
45-
_TENSORFLOW_ARCHIVE_SHA256 = "a62eba23ebfcf1d6d2d3241f1629b99df576a9f726c439a97c3acd590e71fe62"
44+
_TENSORFLOW_GIT_COMMIT = "6887368d6d46223f460358323c4b76d61d1558a8" # tf 2.15.0
45+
_TENSORFLOW_ARCHIVE_SHA256 = "bb25fa4574e42ea4d452979e1d2ba3b86b39569d6b8106a846a238b880d73652"
4646

4747
http_archive(
4848
name = "org_tensorflow",
@@ -53,6 +53,11 @@ http_archive(
5353
strip_prefix = "tensorflow-%s" % _TENSORFLOW_GIT_COMMIT,
5454
)
5555

56+
load("//third_party:python_configure.bzl", "local_python_configure")
57+
local_python_configure(name = "local_config_python")
58+
local_python_configure(name = "local_execution_config_python")
59+
60+
5661
# Please add all new struct2tensor dependencies in workspace.bzl.
5762
load("//struct2tensor:workspace.bzl", "struct2tensor_workspace")
5863
struct2tensor_workspace()
@@ -70,9 +75,9 @@ tf_workspace0()
7075
# boost is required for @thrift
7176
git_repository(
7277
name = "com_github_nelhage_rules_boost",
73-
commit = "9f9fb8b2f0213989247c9d5c0e814a8451d18d7f",
78+
commit = "ff4fefded63953945bcf61bc1f20c924bf7525ce",
7479
remote = "https://github.com/nelhage/rules_boost",
75-
shallow_since = "1570056263 -0700",
80+
shallow_since = "1704355380 -0800",
7681
)
7782

7883
load("@com_github_nelhage_rules_boost//:boost/boost.bzl", "boost_deps")
@@ -84,4 +89,4 @@ rules_pkg_dependencies()
8489

8590
# Specify the minimum required bazel version.
8691
load("@bazel_skylib//lib:versions.bzl", "versions")
87-
versions.check("5.3.0")
92+
versions.check("6.1.0")

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def select_constraint(default, nightly=None, git_master=None):
7878
# with numpy>=1.24.
7979
'numpy>=1.22',
8080
'protobuf>=3.20.3,<5',
81-
'tensorflow>=2.13,<3',
81+
'tensorflow>=2.15,<3',
8282
'tensorflow-metadata' + select_constraint(
8383
default='>=1.14.0,<1.15.0',
8484
nightly='>=1.15.0.dev',

third_party/BUILD

+4
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,7 @@
1414

1515

1616
licenses(["notice"])
17+
18+
exports_files([
19+
"python_configure.bzl",
20+
])

third_party/local_python.BUILD.tpl

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Copyright 2024 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
licenses(["restricted"])
15+
16+
package(default_visibility = ["//visibility:public"])
17+
18+
# Point both runtimes to the same python binary to ensure we always
19+
# use the python binary specified by ./configure.py script.
20+
load("@bazel_tools//tools/python:toolchain.bzl", "py_runtime_pair")
21+
22+
py_runtime(
23+
name = "py2_runtime",
24+
interpreter_path = "%{PYTHON_BIN_PATH}",
25+
python_version = "PY2",
26+
)
27+
28+
py_runtime(
29+
name = "py3_runtime",
30+
interpreter_path = "%{PYTHON_BIN_PATH}",
31+
python_version = "PY3",
32+
)
33+
34+
py_runtime_pair(
35+
name = "py_runtime_pair",
36+
py2_runtime = ":py2_runtime",
37+
py3_runtime = ":py3_runtime",
38+
)
39+
40+
toolchain(
41+
name = "py_toolchain",
42+
toolchain = ":py_runtime_pair",
43+
toolchain_type = "@bazel_tools//tools/python:toolchain_type",
44+
target_compatible_with = [%{PLATFORM_CONSTRAINT}],
45+
exec_compatible_with = [%{PLATFORM_CONSTRAINT}],
46+
)
47+
48+
# To build Python C/C++ extension on Windows, we need to link to python import library pythonXY.lib
49+
# See https://docs.python.org/3/extending/windows.html
50+
cc_import(
51+
name = "python_lib",
52+
interface_library = select({
53+
":windows": ":python_import_lib",
54+
# A placeholder for Unix platforms which makes --no_build happy.
55+
"//conditions:default": "not-existing.lib",
56+
}),
57+
system_provided = 1,
58+
)
59+
60+
cc_library(
61+
name = "python_headers",
62+
hdrs = [":python_include"],
63+
deps = select({
64+
":windows": [":python_lib"],
65+
"//conditions:default": [],
66+
}),
67+
includes = ["python_include"],
68+
)
69+
70+
cc_library(
71+
name = "numpy_headers",
72+
hdrs = [":numpy_include"],
73+
includes = ["numpy_include"],
74+
)
75+
76+
config_setting(
77+
name = "windows",
78+
values = {"cpu": "x64_windows"},
79+
visibility = ["//visibility:public"],
80+
)
81+
82+
%{PYTHON_INCLUDE_GENRULE}
83+
%{NUMPY_INCLUDE_GENRULE}
84+
%{PYTHON_IMPORT_LIB_GENRULE}

0 commit comments

Comments
 (0)