diff --git a/oss_scripts/configure.sh b/oss_scripts/configure.sh index 29b26dfa9..3e6acf2ee 100755 --- a/oss_scripts/configure.sh +++ b/oss_scripts/configure.sh @@ -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 @@ -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) diff --git a/tensorflow_text/BUILD b/tensorflow_text/BUILD index 48ec8ef88..b41b5fdba 100644 --- a/tensorflow_text/BUILD +++ b/tensorflow_text/BUILD @@ -1711,6 +1711,7 @@ py_test( ":test_data_segmenter_hub_module", ], strict_deps = False, + tags = ["manual"], deps = [ ":benchmark_utils", ":ops", @@ -1729,6 +1730,7 @@ py_test( size = "medium", srcs = ["python/benchmarks/ops_benchmarks.py"], strict_deps = False, + tags = ["manual"], deps = [ ":benchmark_utils", ":ops", diff --git a/third_party/bazel/py_deps_profile.bzl b/third_party/bazel/py_deps_profile.bzl index 72d63240c..2f60d3487 100644 --- a/third_party/bazel/py_deps_profile.bzl +++ b/third_party/bazel/py_deps_profile.bzl @@ -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("-", "_") @@ -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, )