Skip to content

Commit eb8bb9e

Browse files
caisqtensorflower-gardener
authored andcommitted
Replace all_files data dependencies of build_pip_package with py_library targets
Benefits of this CL: 1) Removes ~70 python unit test files from the pip wheel. 2) Makes it easier to track which files are included in the pip wheel through bazel queries. Change: 149810103
1 parent 1a833fb commit eb8bb9e

File tree

11 files changed

+132
-43
lines changed

11 files changed

+132
-43
lines changed

tensorflow/contrib/BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ py_library(
5656
"//tensorflow/contrib/specs",
5757
"//tensorflow/contrib/stat_summarizer:stat_summarizer_py",
5858
"//tensorflow/contrib/tensor_forest:init_py",
59-
"//tensorflow/contrib/tensor_forest/hybrid:ops_lib", # XXX: no ref but need for pip
6059
"//tensorflow/contrib/tensorboard",
6160
"//tensorflow/contrib/testing:testing_py",
6261
"//tensorflow/contrib/tfprof",

tensorflow/contrib/graph_editor/BUILD

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ py_library(
2929
],
3030
)
3131

32+
# Transitive dependencies of this target will be included in the pip package.
33+
py_library(
34+
name = "graph_editor_pip",
35+
deps = [
36+
":graph_editor_py",
37+
":match",
38+
],
39+
)
40+
3241
filegroup(
3342
name = "all_files",
3443
srcs = glob(
@@ -41,6 +50,13 @@ filegroup(
4150
visibility = ["//tensorflow:__subpackages__"],
4251
)
4352

53+
py_library(
54+
name = "match",
55+
srcs = ["tests/match.py"],
56+
srcs_version = "PY2AND3",
57+
deps = [":graph_editor_py"],
58+
)
59+
4460
py_test(
4561
name = "util_test",
4662
srcs = ["tests/util_test.py"],
@@ -71,13 +87,11 @@ py_test(
7187

7288
py_test(
7389
name = "match_test",
74-
srcs = [
75-
"tests/match.py",
76-
"tests/match_test.py",
77-
],
90+
srcs = ["tests/match_test.py"],
7891
srcs_version = "PY2AND3",
7992
deps = [
8093
":graph_editor_py",
94+
":match",
8195
"//tensorflow/python:client_testlib",
8296
"//tensorflow/python:framework_for_generated_wrappers",
8397
"//tensorflow/python:framework_test_lib",
@@ -102,13 +116,11 @@ py_test(
102116

103117
py_test(
104118
name = "reroute_test",
105-
srcs = [
106-
"tests/match.py",
107-
"tests/reroute_test.py",
108-
],
119+
srcs = ["tests/reroute_test.py"],
109120
srcs_version = "PY2AND3",
110121
deps = [
111122
":graph_editor_py",
123+
":match",
112124
"//tensorflow/python:client_testlib",
113125
"//tensorflow/python:framework_for_generated_wrappers",
114126
"//tensorflow/python:framework_test_lib",
@@ -119,13 +131,11 @@ py_test(
119131

120132
py_test(
121133
name = "edit_test",
122-
srcs = [
123-
"tests/edit_test.py",
124-
"tests/match.py",
125-
],
134+
srcs = ["tests/edit_test.py"],
126135
srcs_version = "PY2AND3",
127136
deps = [
128137
":graph_editor_py",
138+
":match",
129139
"//tensorflow/python:client_testlib",
130140
"//tensorflow/python:framework_for_generated_wrappers",
131141
"//tensorflow/python:framework_test_lib",
@@ -136,13 +146,11 @@ py_test(
136146

137147
py_test(
138148
name = "transform_test",
139-
srcs = [
140-
"tests/match.py",
141-
"tests/transform_test.py",
142-
],
149+
srcs = ["tests/transform_test.py"],
143150
srcs_version = "PY2AND3",
144151
deps = [
145152
":graph_editor_py",
153+
":match",
146154
"//tensorflow/python:array_ops",
147155
"//tensorflow/python:client",
148156
"//tensorflow/python:client_testlib",

tensorflow/contrib/labeled_tensor/BUILD

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ py_library(
2222
],
2323
)
2424

25+
# Transitive dependencies of this target will be included in the pip package.
26+
py_library(
27+
name = "labeled_tensor_pip",
28+
deps = [
29+
":labeled_tensor",
30+
":test_util",
31+
],
32+
)
33+
2534
py_library(
2635
name = "_typecheck",
2736
srcs = ["python/ops/_typecheck.py"],

tensorflow/contrib/session_bundle/BUILD

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,16 @@ filegroup(
4141
]),
4242
)
4343

44+
# Transitive dependencies of this target will be included in the pip package.
45+
py_library(
46+
name = "session_bundle_pip",
47+
deps = [
48+
":bundle_shim_py",
49+
":exporter",
50+
":gc",
51+
],
52+
)
53+
4454
py_library(
4555
name = "bundle_shim_py",
4656
srcs = ["bundle_shim.py"],

tensorflow/contrib/slim/python/slim/data/BUILD

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ py_library(
2020
],
2121
)
2222

23+
# Transitive dependencies of this target will be included in the pip package.
24+
py_library(
25+
name = "data_pip",
26+
deps = [
27+
":data",
28+
":test_utils",
29+
],
30+
)
31+
2332
py_library(
2433
name = "data_decoder",
2534
srcs = ["data_decoder.py"],

tensorflow/contrib/slim/python/slim/nets/BUILD

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,19 @@ package(
1414
],
1515
)
1616

17+
# Transitive dependencies of this target will be included in the pip package.
18+
py_library(
19+
name = "nets_pip",
20+
deps = [
21+
":alexnet",
22+
":inception",
23+
":overfeat",
24+
":resnet_v1",
25+
":resnet_v2",
26+
":vgg",
27+
],
28+
)
29+
1730
py_library(
1831
name = "alexnet",
1932
srcs = ["alexnet.py"],

tensorflow/contrib/tensor_forest/hybrid/BUILD

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,3 +394,18 @@ py_library(
394394
"//tensorflow/contrib/tensor_forest:tensor_forest_py",
395395
],
396396
)
397+
398+
# Transitive dependencies of this target will be included in the pip package.
399+
py_library(
400+
name = "hybrid_pip",
401+
deps = [
402+
":all_layers",
403+
":decisions_to_data_then_nn",
404+
":forest_to_data_then_nn",
405+
":hard_decisions_to_data_then_nn",
406+
":k_feature_decisions_to_data_then_nn",
407+
":nn",
408+
":stochastic_hard_decisions_to_data_then_nn",
409+
":stochastic_soft_decisions_to_data_then_nn",
410+
],
411+
)

tensorflow/python/debug/BUILD

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ py_library(
2929
],
3030
)
3131

32+
# Transitive dependencies of this target will be included in the pip package.
33+
py_library(
34+
name = "debug_pip",
35+
deps = [
36+
":debug_py",
37+
":session_debug_testlib",
38+
],
39+
)
40+
3241
py_library(
3342
name = "debug_data",
3443
srcs = ["lib/debug_data.py"],

tensorflow/python/tools/BUILD

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,18 @@ exports_files(["LICENSE"])
99

1010
load("//tensorflow:tensorflow.bzl", "py_test")
1111

12+
# Transitive dependencies of this target will be included in the pip package.
13+
py_library(
14+
name = "tools_pip",
15+
deps = [
16+
":freeze_graph",
17+
":inspect_checkpoint",
18+
":optimize_for_inference",
19+
":print_selective_registration_header",
20+
":strip_unused",
21+
],
22+
)
23+
1224
py_library(
1325
name = "freeze_graph_lib",
1426
srcs = ["freeze_graph.py"],

tensorflow/tools/ci_build/builds/pip.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,11 @@ if [[ $(echo ${WHL_PATH} | wc -w) -ne 1 ]]; then
165165
"directory: ${PIP_WHL_DIR}"
166166
fi
167167

168+
# Print the size of the PIP wheel file.
169+
echo
170+
echo "Size of the PIP wheel file built: $(ls -l ${WHL_PATH} | awk '{print $5}')"
171+
echo
172+
168173
# Rename the whl file properly so it will have the python
169174
# version tags and platform tags that won't cause pip install issues.
170175
if [[ $(uname) == "Linux" ]]; then

0 commit comments

Comments
 (0)