Skip to content

Commit c4e0446

Browse files
sampathwebtensorflower-gardener
authored andcommitted
Pin tf_keras to tf or tf_nightly
PiperOrigin-RevId: 607045302
1 parent 4a736ac commit c4e0446

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

oss_setup.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@
3737
"`pip_build.py` instead of `setup.py`."
3838
)
3939

40+
# pin version to that of tensorflow or tf_nightly.
41+
if "nightly" in "{{PACKAGE}}":
42+
install_requires = ["tf-nightly~={{VERSION}}.dev"]
43+
else:
44+
install_requires = ["tensorflow~={{VERSION}}"]
45+
4046
setuptools.setup(
4147
name="{{PACKAGE}}",
4248
# Version strings with `-` characters are semver compatible,
@@ -49,7 +55,7 @@
4955
author="Keras team",
5056
author_email="keras-users@googlegroups.com",
5157
packages=setuptools.find_packages(),
52-
install_requires=[],
58+
install_requires=install_requires,
5359
# Supported Python versions
5460
python_requires=">=3.9",
5561
# PyPI package information.
@@ -63,6 +69,7 @@
6369
"Programming Language :: Python :: 3.9",
6470
"Programming Language :: Python :: 3.10",
6571
"Programming Language :: Python :: 3.11",
72+
"Programming Language :: Python :: 3.12",
6673
"Programming Language :: Python :: 3 :: Only",
6774
"Topic :: Scientific/Engineering",
6875
"Topic :: Scientific/Engineering :: Mathematics",

pip_build.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,13 +449,14 @@ def test_wheel(wheel_path, expected_version, requirements_path):
449449
checks = ";".join(symbols_to_check)
450450
# Uninstall `keras-nightly` after installing requirements
451451
# otherwise both will register `experimentalOptimizer` and test will fail.
452+
# Skip install deps for `tf_keras` as TensorFlow installed from requirements
452453
script = (
453454
"#!/bin/bash\n"
454455
"virtualenv kenv\n"
455456
f"source {os.path.join('kenv', 'bin', 'activate')}\n"
456457
f"pip3 install -r {requirements_path}\n"
457458
"pip3 uninstall -y keras-nightly\n"
458-
f"pip3 install {wheel_path} --force-reinstall\n"
459+
f"pip3 install {wheel_path} --force-reinstall --no-deps\n"
459460
f"python3 -c 'import tf_keras;{checks};print(tf_keras.__version__)'\n"
460461
)
461462
try:

0 commit comments

Comments
 (0)