[go: nahoru, domu]

Skip to content

Commit

Permalink
Add typing_extensions dependency. This is a very light dependency (ro…
Browse files Browse the repository at this point in the history
…ughly two Python files) that is useful to unlock typing features present only in the latest Python versions.

PiperOrigin-RevId: 327637134
Change-Id: Ifb4cd1314a6f8feee4f452a8256cff27c1acd590
  • Loading branch information
Dan Moldovan authored and tensorflower-gardener committed Aug 20, 2020
1 parent 4b51c48 commit c725901
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions tensorflow/opensource_only.files
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ tensorflow/third_party/toolchains/remote_config/BUILD
tensorflow/third_party/toolchains/remote_config/configs.bzl
tensorflow/third_party/toolchains/remote_config/containers.bzl
tensorflow/third_party/toolchains/remote_config/rbe_config.bzl
tensorflow/third_party/typing_extensions.BUILD
tensorflow/third_party/wrapt.BUILD
tensorflow/third_party/zlib.BUILD
tensorflow/tools/build_info/BUILD
Expand Down
2 changes: 2 additions & 0 deletions tensorflow/tools/ci_build/release/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ function install_pip_deps {
${SUDO_CMD} ${PIP_CMD} install portpicker
${SUDO_CMD} ${PIP_CMD} install scipy
${SUDO_CMD} ${PIP_CMD} install scikit-learn
${SUDO_CMD} ${PIP_CMD} install typing_extensions
${SUDO_CMD} ${PIP_CMD} install --upgrade tb-nightly
${PIP_CMD} install --user --upgrade flatbuffers
${PIP_CMD} install --user --upgrade attrs
Expand Down Expand Up @@ -178,6 +179,7 @@ function install_ubuntu_16_pip_deps {
"${PIP_CMD}" install portpicker --user
"${PIP_CMD}" install scipy --user
"${PIP_CMD}" install scikit-learn --user
"${PIP_CMD}" install typing_extensions --user
"${PIP_CMD}" install PyYAML==3.13 --user
# b/156523241
"${PIP_CMD}" install --force-reinstall --user --upgrade tf-estimator-nightly
Expand Down
1 change: 1 addition & 0 deletions tensorflow/tools/pip_package/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
'tensorboard >= 2.3.0, < 3',
'tensorflow_estimator >= 2.3.0, < 2.4.0',
'termcolor >= 1.1.0',
'typing_extensions >= 3.7.4.2',
'wrapt >= 1.11.1',
'wheel >= 0.26',
'six >= 1.12.0',
Expand Down
12 changes: 12 additions & 0 deletions tensorflow/workspace.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,18 @@ def tf_repositories(path_prefix = "", tf_repo_name = ""):
],
)

tf_http_archive(
name = "typing_extensions_archive",
build_file = clean_dep("//third_party:typing_extensions.BUILD"),
sha256 = "79ee589a3caca649a9bfd2a8de4709837400dfa00b6cc81962a1e6a1815969ae",
strip_prefix = "typing_extensions-3.7.4.2",
system_build_file = clean_dep("//third_party/systemlibs:six.BUILD"),
urls = [
"http://mirror.tensorflow.org/files.pythonhosted.org/packages/6a/28/d32852f2af6b5ead85d396249d5bdf450833f3a69896d76eb480d9c5e406/typing_extensions-3.7.4.2.tar.gz",
"https://files.pythonhosted.org/packages/6a/28/d32852f2af6b5ead85d396249d5bdf450833f3a69896d76eb480d9c5e406/typing_extensions-3.7.4.2.tar.gz",
],
)

tf_http_archive(
name = "opt_einsum_archive",
build_file = clean_dep("//third_party:opt_einsum.BUILD"),
Expand Down
14 changes: 14 additions & 0 deletions third_party/typing_extensions.BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Description:
# Backports for the typing module to older Python versions. See
# https://github.com/python/typing/blob/master/typing_extensions/README.rst

licenses(["notice"]) # PSF

exports_files(["LICENSE"])

py_library(
name = "typing_extensions",
srcs = ["src_py3/typing_extensions.py"],
srcs_version = "PY2AND3",
visibility = ["//visibility:public"],
)

0 comments on commit c725901

Please sign in to comment.