Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions oss_scripts/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ sed -i -e 's/build --noincompatible_remove_legacy_whole_archive//' .bazelrc

write_to_bazelrc "build:manylinux2014 --config=release_cpu_linux"
write_to_bazelrc "test --test_env=TF_USE_LEGACY_KERAS=1"
write_to_bazelrc "common --features=-external_include_paths"
write_to_bazelrc "common --host_features=-external_include_paths"

if [ -z "$HERMETIC_PYTHON_VERSION" ]; then
if [ -n "$PY_VERSION" ]; then
Expand All @@ -73,9 +75,28 @@ if [ -z "$HERMETIC_PYTHON_VERSION" ]; then
fi
export HERMETIC_PYTHON_VERSION

if [[ -n "$HERMETIC_PYTHON_VERSION" ]]; then
write_to_bazelrc "build --repo_env=HERMETIC_PYTHON_VERSION=${HERMETIC_PYTHON_VERSION}"
fi
if [[ -n "$IS_NIGHTLY" ]]; then
write_to_bazelrc "build --repo_env=IS_NIGHTLY=${IS_NIGHTLY}"
fi

# Only auto-upgrade requirements for nightly.
if [[ "$IS_NIGHTLY" == "nightly" ]]; then
bazel run //oss_scripts/pip_package:requirements.update -- --upgrade
# Append tf-keras-nightly directly to the lockfile so its lagging
# Requires-Dist constraint on tf-nightly does not downgrade tf-nightly during
# pip-compile, while still providing @pypi_tf_keras_nightly for pip_parse.
$installed_python -c '
import json, sys, urllib.request
lock_path, pkg = sys.argv[1], sys.argv[2]
data = json.loads(urllib.request.urlopen(f"https://pypi.org/pypi/{pkg}/json").read())
ver = data["info"]["version"]
hashes = [" --hash=sha256:" + u["digests"]["sha256"] for u in data["urls"] if "sha256" in u.get("digests", {})]
with open(lock_path, "a") as f:
f.write(f"\n{pkg}=={ver} \\\n" + " \\\n".join(hashes) + "\n")
' "oss_scripts/pip_package/requirements_lock_${HERMETIC_PYTHON_VERSION//./_}.txt" "tf-keras-nightly"
fi

TF_ABIFLAG=$(bazel run //oss_scripts/pip_package:tensorflow_build_info -- abi)
Expand Down
2 changes: 2 additions & 0 deletions tensorflow_text/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -1711,6 +1711,7 @@ py_test(
":test_data_segmenter_hub_module",
],
strict_deps = False,
tags = ["manual"],
deps = [
":benchmark_utils",
":ops",
Expand All @@ -1729,6 +1730,7 @@ py_test(
size = "medium",
srcs = ["python/benchmarks/ops_benchmarks.py"],
strict_deps = False,
tags = ["manual"],
deps = [
":benchmark_utils",
":ops",
Expand Down
14 changes: 12 additions & 2 deletions third_party/bazel/py_deps_profile.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,15 @@ def _py_deps_profile_impl(ctx):
build_content = ['exports_files(["{}"])'.format(requirements_name)]
for k, v in ctx.attr.deps_map.items():
repo_name = v[0] if is_switch else k
requirements_in_substitutions[k + "\n"] = repo_name + "\n"
requirements_in_substitutions[k + "\r\n"] = repo_name + "\r\n"
if k == "tf-keras":
# Exclude tf-keras / tf-keras-nightly from requirements.in so its
# lagging Requires-Dist on tensorflow / tf-nightly does not
# downgrade or block pip-compile during requirements.update.
requirements_in_substitutions[k + "\n"] = ""
requirements_in_substitutions[k + "\r\n"] = ""
else:
requirements_in_substitutions[k + "\n"] = repo_name + "\n"
requirements_in_substitutions[k + "\r\n"] = repo_name + "\r\n"
aliased_targets = ["pkg"] + v[1:]
norm_repo_name = repo_name.replace("-", "_")
norm_alas_name = k.replace("-", "_")
Expand Down Expand Up @@ -45,5 +52,8 @@ py_deps_profile = repository_rule(
"pip_repo_name": attr.string(mandatory = True),
"switch": attr.string_dict(mandatory = True),
},
environ = [
"IS_NIGHTLY",
],
local = True,
)
Loading