Skip to content

Commit 3ec6e47

Browse files
teijeongtensorflower-gardener
authored andcommitted
OSS cleanup: improve copybara process to keep strict rules.
This reduces technical debt from managing internal `strict` python rules. Added placeholder rules until bazel supports them. PiperOrigin-RevId: 370019453
1 parent 5d4c6cf commit 3ec6e47

File tree

14 files changed

+139
-54
lines changed

14 files changed

+139
-54
lines changed

tensorflow_model_optimization/python/core/common/keras/compression/BUILD

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
load("//tensorflow_model_optimization:tensorflow_model_optimization.bzl", "pytype_library")
2+
13
licenses(["notice"])
24

3-
py_library(
5+
pytype_library(
46
name = "algorithm",
57
srcs = ["algorithm.py"],
68
srcs_version = "PY3",

tensorflow_model_optimization/python/core/common/keras/compression/algorithms/BUILD

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
load("//tensorflow_model_optimization:tensorflow_model_optimization.bzl", "pytype_library")
2+
13
package(default_visibility = ["//visibility:private"])
24

35
licenses(["notice"])
46

5-
py_library(
7+
pytype_library(
68
name = "same_training_and_inference",
79
srcs = ["same_training_and_inference.py"],
810
srcs_version = "PY3",
@@ -24,7 +26,7 @@ py_test(
2426
],
2527
)
2628

27-
py_library(
29+
pytype_library(
2830
name = "different_training_and_inference",
2931
srcs = ["different_training_and_inference.py"],
3032
srcs_version = "PY3",
@@ -46,7 +48,7 @@ py_test(
4648
],
4749
)
4850

49-
py_library(
51+
pytype_library(
5052
name = "bias_only",
5153
srcs = ["bias_only.py"],
5254
srcs_version = "PY3",
@@ -91,7 +93,7 @@ py_test(
9193
],
9294
)
9395

94-
py_library(
96+
pytype_library(
9597
name = "periodical_update_and_scheduling",
9698
srcs = ["periodical_update_and_scheduling.py"],
9799
srcs_version = "PY3",

tensorflow_model_optimization/python/core/common/keras/compression/internal/BUILD

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
load("//tensorflow_model_optimization:tensorflow_model_optimization.bzl", "pytype_library")
2+
13
package(default_visibility = [
24
"//tensorflow_model_optimization/python/core/common/keras/compression:__subpackages__",
35
])
46

57
licenses(["notice"])
68

7-
py_library(
9+
pytype_library(
810
name = "optimize",
911
srcs = ["optimize.py"],
1012
srcs_version = "PY3",

tensorflow_model_optimization/python/core/internal/BUILD

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
load("//tensorflow_model_optimization:tensorflow_model_optimization.bzl", "py_strict_library")
2+
13
package(default_visibility = ["//visibility:public"])
24

35
licenses(["notice"]) # Apache 2.0
46

5-
py_library(
7+
py_strict_library(
68
name = "internal",
79
srcs = ["__init__.py"],
810
srcs_version = "PY3",

tensorflow_model_optimization/python/core/internal/tensor_encoding/BUILD

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
load("//tensorflow_model_optimization:tensorflow_model_optimization.bzl", "py_strict_library")
2+
13
package(default_visibility = ["//visibility:public"])
24

35
licenses(["notice"]) # Apache 2.0
46

5-
py_library(
7+
py_strict_library(
68
name = "tensor_encoding",
79
srcs = ["__init__.py"],
810
srcs_version = "PY3",

tensorflow_model_optimization/python/core/internal/tensor_encoding/core/BUILD

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1+
# buildifier: disable=same-origin-load
2+
load("//tensorflow_model_optimization:tensorflow_model_optimization.bzl", "py_strict_library")
3+
4+
# buildifier: disable=same-origin-load
5+
load("//tensorflow_model_optimization:tensorflow_model_optimization.bzl", "py_strict_test")
6+
17
package(default_visibility = [
28
"//tensorflow_model_optimization/python/core/internal/tensor_encoding:__subpackages__",
39
])
410

511
licenses(["notice"]) # Apache 2.0
612

7-
py_library(
13+
py_strict_library(
814
name = "core",
915
srcs = ["__init__.py"],
1016
visibility = ["//visibility:public"],
@@ -16,7 +22,7 @@ py_library(
1622
],
1723
)
1824

19-
py_library(
25+
py_strict_library(
2026
name = "core_encoder",
2127
srcs = ["core_encoder.py"],
2228
deps = [
@@ -27,7 +33,7 @@ py_library(
2733
],
2834
)
2935

30-
py_test(
36+
py_strict_test(
3137
name = "core_encoder_test",
3238
size = "small",
3339
srcs = ["core_encoder_test.py"],
@@ -41,7 +47,7 @@ py_test(
4147
],
4248
)
4349

44-
py_library(
50+
py_strict_library(
4551
name = "encoding_stage",
4652
srcs = ["encoding_stage.py"],
4753
deps = [
@@ -51,7 +57,7 @@ py_library(
5157
],
5258
)
5359

54-
py_test(
60+
py_strict_test(
5561
name = "encoding_stage_test",
5662
size = "small",
5763
srcs = ["encoding_stage_test.py"],
@@ -66,7 +72,7 @@ py_test(
6672
],
6773
)
6874

69-
py_library(
75+
py_strict_library(
7076
name = "gather_encoder",
7177
srcs = ["gather_encoder.py"],
7278
deps = [
@@ -76,7 +82,7 @@ py_library(
7682
],
7783
)
7884

79-
py_test(
85+
py_strict_test(
8086
name = "gather_encoder_test",
8187
size = "small",
8288
srcs = ["gather_encoder_test.py"],
@@ -93,7 +99,7 @@ py_test(
9399
],
94100
)
95101

96-
py_library(
102+
py_strict_library(
97103
name = "simple_encoder",
98104
srcs = ["simple_encoder.py"],
99105
deps = [
@@ -103,7 +109,7 @@ py_library(
103109
],
104110
)
105111

106-
py_test(
112+
py_strict_test(
107113
name = "simple_encoder_test",
108114
size = "small",
109115
srcs = ["simple_encoder_test.py"],

tensorflow_model_optimization/python/core/internal/tensor_encoding/encoders/BUILD

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1+
# buildifier: disable=same-origin-load
2+
load("//tensorflow_model_optimization:tensorflow_model_optimization.bzl", "py_strict_library")
3+
4+
# buildifier: disable=same-origin-load
5+
load("//tensorflow_model_optimization:tensorflow_model_optimization.bzl", "py_strict_test")
6+
17
package(default_visibility = [
28
"//tensorflow_model_optimization/python/core/internal/tensor_encoding:__subpackages__",
39
])
410

511
licenses(["notice"]) # Apache 2.0
612

7-
py_library(
13+
py_strict_library(
814
name = "encoders",
915
srcs = ["__init__.py"],
1016
visibility = ["//visibility:public"],
@@ -13,7 +19,7 @@ py_library(
1319
],
1420
)
1521

16-
py_library(
22+
py_strict_library(
1723
name = "common_encoders",
1824
srcs = ["common_encoders.py"],
1925
deps = [
@@ -25,7 +31,7 @@ py_library(
2531
],
2632
)
2733

28-
py_test(
34+
py_strict_test(
2935
name = "common_encoders_test",
3036
size = "small",
3137
srcs = ["common_encoders_test.py"],

tensorflow_model_optimization/python/core/internal/tensor_encoding/stages/BUILD

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1+
# buildifier: disable=same-origin-load
2+
load("//tensorflow_model_optimization:tensorflow_model_optimization.bzl", "py_strict_library")
3+
4+
# buildifier: disable=same-origin-load
5+
load("//tensorflow_model_optimization:tensorflow_model_optimization.bzl", "py_strict_test")
6+
17
package(default_visibility = [
28
"//tensorflow_model_optimization/python/core/internal/tensor_encoding:__subpackages__",
39
])
410

511
licenses(["notice"]) # Apache 2.0
612

7-
py_library(
13+
py_strict_library(
814
name = "stages",
915
srcs = ["__init__.py"],
1016
visibility = ["//visibility:public"],
@@ -14,7 +20,7 @@ py_library(
1420
],
1521
)
1622

17-
py_library(
23+
py_strict_library(
1824
name = "stages_impl",
1925
srcs = ["stages_impl.py"],
2026
deps = [
@@ -25,7 +31,7 @@ py_library(
2531
],
2632
)
2733

28-
py_test(
34+
py_strict_test(
2935
name = "stages_impl_test",
3036
size = "medium",
3137
srcs = ["stages_impl_test.py"],

tensorflow_model_optimization/python/core/internal/tensor_encoding/stages/research/BUILD

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1+
# buildifier: disable=same-origin-load
2+
load("//tensorflow_model_optimization:tensorflow_model_optimization.bzl", "py_strict_library")
3+
4+
# buildifier: disable=same-origin-load
5+
load("//tensorflow_model_optimization:tensorflow_model_optimization.bzl", "py_strict_test")
6+
17
package(default_visibility = [
28
"//tensorflow_model_optimization/python/core/internal/tensor_encoding:__subpackages__",
39
])
410

511
licenses(["notice"]) # Apache 2.0
612

7-
py_library(
13+
py_strict_library(
814
name = "research",
915
srcs = ["__init__.py"],
1016
visibility = ["//visibility:public"],
@@ -16,7 +22,7 @@ py_library(
1622
],
1723
)
1824

19-
py_library(
25+
py_strict_library(
2026
name = "clipping",
2127
srcs = ["clipping.py"],
2228
deps = [
@@ -25,7 +31,7 @@ py_library(
2531
],
2632
)
2733

28-
py_test(
34+
py_strict_test(
2935
name = "clipping_test",
3036
size = "small",
3137
srcs = ["clipping_test.py"],
@@ -39,7 +45,7 @@ py_test(
3945
],
4046
)
4147

42-
py_library(
48+
py_strict_library(
4349
name = "kashin",
4450
srcs = ["kashin.py"],
4551
deps = [
@@ -50,7 +56,7 @@ py_library(
5056
],
5157
)
5258

53-
py_test(
59+
py_strict_test(
5460
name = "kashin_test",
5561
size = "medium",
5662
srcs = ["kashin_test.py"],
@@ -64,7 +70,7 @@ py_test(
6470
],
6571
)
6672

67-
py_library(
73+
py_strict_library(
6874
name = "quantization",
6975
srcs = ["quantization.py"],
7076
deps = [
@@ -74,7 +80,7 @@ py_library(
7480
],
7581
)
7682

77-
py_test(
83+
py_strict_test(
7884
name = "quantization_test",
7985
size = "small",
8086
srcs = ["quantization_test.py"],
@@ -88,7 +94,7 @@ py_test(
8894
],
8995
)
9096

91-
py_library(
97+
py_strict_library(
9298
name = "misc",
9399
srcs = ["misc.py"],
94100
deps = [
@@ -97,7 +103,7 @@ py_library(
97103
],
98104
)
99105

100-
py_test(
106+
py_strict_test(
101107
name = "misc_test",
102108
size = "small",
103109
srcs = ["misc_test.py"],

tensorflow_model_optimization/python/core/internal/tensor_encoding/testing/BUILD

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1+
# buildifier: disable=same-origin-load
2+
load("//tensorflow_model_optimization:tensorflow_model_optimization.bzl", "py_strict_library")
3+
4+
# buildifier: disable=same-origin-load
5+
load("//tensorflow_model_optimization:tensorflow_model_optimization.bzl", "py_strict_test")
6+
17
package(default_visibility = [
28
"//tensorflow_model_optimization/python/core/internal/tensor_encoding:__subpackages__",
39
])
410

511
licenses(["notice"]) # Apache 2.0
612

7-
py_library(
13+
py_strict_library(
814
name = "testing",
915
srcs = ["__init__.py"],
1016
visibility = ["//visibility:public"],
@@ -13,7 +19,7 @@ py_library(
1319
],
1420
)
1521

16-
py_library(
22+
py_strict_library(
1723
name = "test_utils",
1824
srcs = ["test_utils.py"],
1925
deps = [
@@ -26,7 +32,7 @@ py_library(
2632
],
2733
)
2834

29-
py_test(
35+
py_strict_test(
3036
name = "test_utils_test",
3137
size = "medium",
3238
srcs = ["test_utils_test.py"],

0 commit comments

Comments
 (0)