Skip to content

Commit 41f92bf

Browse files
authored
Update tf-keras version requirements to match TF version ignoring the minor version. This allows tf-keras and TensorFlow to have their own patch releases without having to have a corresponding patch release. (#758)
PiperOrigin-RevId: 612968532
1 parent 3614a31 commit 41f92bf

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

oss_setup.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,23 @@
3939

4040
# pin version to that of tensorflow or tf_nightly.
4141
version = "{{VERSION}}".lower()
42+
major_version, minor_version, *_ = version.split(".")
43+
next_minor_version = int(minor_version) + 1
4244
if "nightly" in "{{PACKAGE}}":
4345
base_version = version.split(".dev")[0] # 2.17.0.dev2024021419
4446
install_requires = [f"tf-nightly~={base_version}.dev"]
4547
elif "rc" in version:
46-
base_version = version.split("rc")[0] # 2.16.0rc0
47-
install_requires = [f"tensorflow~={base_version}rc"]
48+
# 2.17.0rc0
49+
install_requires = [
50+
f"tensorflow>={major_version}.{minor_version}.0rc0, "
51+
f"<{major_version}.{next_minor_version}"
52+
]
4853
else:
49-
install_requires = ["tensorflow~={{VERSION}}"]
54+
# Match any TF patch version since patches shouldn't break compatibility.
55+
install_requires = [
56+
f"tensorflow>={major_version}.{minor_version}, "
57+
f"<{major_version}.{next_minor_version}"
58+
]
5059

5160
setuptools.setup(
5261
name="{{PACKAGE}}",

0 commit comments

Comments
 (0)