Skip to content

Commit 3aee8d8

Browse files
authored
Updates (vendored) bleach to 6.2.0 and removes dependencies on six and html5lib (#7013)
## Motivation for features / changes Addresses #7010. The old version of bleach that we were using, needed dependencies `six` and `html5lib` to be installed, and the old version of "six" that we were using for CI via bazel is not supported in python >= 3.12, which causes some issues at least for local builds and CI when using newer versions of python. ## Technical description of changes Update the version of bleach specified in the `http_archive` rule used by bazel and remove rules referring to `six` and `html5lib`. ## Detailed steps to verify changes work correctly (as executed by you) Created a virtualenv with python 3.12+ and ran `bazel run //tensorboard -- --logdir=<logdir>`, and verified that it runs correctly. Also CI should be passing for this to get merged.
1 parent b0a4e02 commit 3aee8d8

File tree

9 files changed

+9
-119
lines changed

9 files changed

+9
-119
lines changed

tensorboard/pip_package/BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ genrule(
8686
"@npm//:node_modules/d3/LICENSE",
8787
"@com_google_fonts_roboto//:LICENSE",
8888
"@org_mozilla_bleach//:LICENSE",
89-
"@org_html5lib//:LICENSE",
9089
"@org_pythonhosted_webencodings//:LICENSE",
9190
"//third_party:bh_tsne.LICENSE",
9291
],

tensorboard/pip_package/build_pip_package.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,12 @@ build() (
8686

8787
mkdir -p tensorboard/_vendor
8888
>tensorboard/_vendor/__init__.py
89-
cp -LR "${RUNFILES}/org_html5lib/html5lib" tensorboard/_vendor
9089
cp -LR "${RUNFILES}/org_mozilla_bleach/bleach" tensorboard/_vendor
9190
cp -LR "${RUNFILES}/org_pythonhosted_webencodings/webencodings" tensorboard/_vendor
9291

9392
chmod -R u+w,go+r .
9493

9594
find tensorboard -name \*.py -exec $sedi -e '
96-
s/^import html5lib$/from tensorboard._vendor import html5lib/
97-
s/^from html5lib/from tensorboard._vendor.html5lib/
9895
s/^import bleach$/from tensorboard._vendor import bleach/
9996
s/^from bleach/from tensorboard._vendor.bleach/
10097
s/^import webencodings$/from tensorboard._vendor import webencodings/

tensorboard/pip_package/requirements.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,5 @@ packaging
3333
# https://github.com/protocolbuffers/protobuf/issues/13485
3434
protobuf >= 3.19.6, != 4.24.0
3535
setuptools >= 41.0.0 # Note: provides pkg_resources as well as setuptools
36-
# A dependency of our vendored packages. This lower bound has not been correctly
37-
# vetted, but I wanted to be the least restrictive we can, since it's not a new
38-
# requirement, and likely this will not disrupt existing users of the package.
39-
six > 1.9
4036
tensorboard-data-server >= 0.7.0, < 0.8.0
4137
werkzeug >= 1.0.1

tensorboard/plugins/text/BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ py_library(
2121
"//tensorboard/backend:http_util",
2222
"//tensorboard/data:provider",
2323
"//tensorboard/plugins:base_plugin",
24-
"@org_mozilla_bleach",
2524
"@org_pocoo_werkzeug",
2625
"@org_pythonhosted_markdown",
2726
],

third_party/bleach.BUILD

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,11 @@ py_library(
1515
srcs = [
1616
"bleach/__init__.py",
1717
"bleach/callbacks.py",
18-
"bleach/encoding.py",
18+
"bleach/html5lib_shim.py",
1919
"bleach/linkifier.py",
20+
"bleach/parse_shim.py",
2021
"bleach/sanitizer.py",
21-
"bleach/utils.py",
22-
"bleach/version.py",
23-
],
24-
srcs_version = "PY3",
25-
deps = [
26-
"@org_html5lib",
27-
"@org_pythonhosted_six",
28-
],
22+
"bleach/six_shim.py",
23+
] + glob(["bleach/_vendor/**/*.py"]),
24+
deps = ["@org_pythonhosted_webencodings"],
2925
)

third_party/html5lib.BUILD

Lines changed: 0 additions & 54 deletions
This file was deleted.

third_party/python.bzl

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -44,25 +44,14 @@ def tensorboard_python_workspace():
4444
build_file = str(Label("//third_party:urllib3.BUILD")),
4545
)
4646

47-
http_archive(
48-
name = "org_html5lib",
49-
urls = [
50-
"http://mirror.tensorflow.org/github.com/html5lib/html5lib-python/archive/1.1.tar.gz",
51-
"https://github.com/html5lib/html5lib-python/archive/1.1.tar.gz",
52-
],
53-
sha256 = "66e9e24a53c10c27abb6be8a3cf2cf55824c6ea1cef8570a633cb223ec46e894",
54-
strip_prefix = "html5lib-python-1.1",
55-
build_file = str(Label("//third_party:html5lib.BUILD")),
56-
)
57-
5847
http_archive(
5948
name = "org_mozilla_bleach",
6049
urls = [
61-
"http://mirror.tensorflow.org/github.com/mozilla/bleach/archive/v2.0.tar.gz",
62-
"https://github.com/mozilla/bleach/archive/v2.0.tar.gz",
50+
"http://mirror.tensorflow.org/files.pythonhosted.org/packages/76/9a/0e33f5054c54d349ea62c277191c020c2d6ef1d65ab2cb1993f91ec846d1/bleach-6.2.0.tar.gz",
51+
"https://files.pythonhosted.org/packages/76/9a/0e33f5054c54d349ea62c277191c020c2d6ef1d65ab2cb1993f91ec846d1/bleach-6.2.0.tar.gz"
6352
],
64-
strip_prefix = "bleach-2.0",
65-
sha256 = "789dcf3e7daf79c4c78518c6ebafd51bbaf111ac4263a97c08cf8d6a27eda820",
53+
strip_prefix = "bleach-6.2.0",
54+
sha256 = "123e894118b8a599fd80d3ec1a6d4cc7ce4e5882b1317a7e1ba69b56e95f991f",
6655
build_file = str(Label("//third_party:bleach.BUILD")),
6756
)
6857

@@ -99,13 +88,3 @@ def tensorboard_python_workspace():
9988
],
10089
)
10190

102-
http_archive(
103-
name = "org_pythonhosted_six",
104-
urls = [
105-
"http://mirror.tensorflow.org/pypi.python.org/packages/source/s/six/six-1.13.0.tar.gz",
106-
"https://pypi.python.org/packages/source/s/six/six-1.13.0.tar.gz",
107-
],
108-
sha256 = "30f610279e8b2578cab6db20741130331735c781b56053c59c4076da27f06b66",
109-
strip_prefix = "six-1.13.0",
110-
build_file = str(Label("//third_party:six.BUILD")),
111-
)

third_party/six.BUILD

Lines changed: 0 additions & 16 deletions
This file was deleted.

third_party/workspace.bzl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,6 @@ def tensorboard_workspace(name = ""):
3535
tensorboard_js_workspace()
3636
tensorboard_rust_workspace()
3737

38-
# Protobuf's BUILD file depends on //external:six.
39-
native.bind(
40-
name = "six",
41-
actual = "@org_pythonhosted_six",
42-
)
43-
4438
# Needed by Protobuf.
4539
native.bind(
4640
name = "grpc_python_plugin",

0 commit comments

Comments
 (0)