BUILD 3.62 KB
Newer Older
1
2
load("@rules_python//python:defs.bzl", "py_library", "py_test")

3
package(default_visibility = ["//tensorflow_federated:internal"])
4

5
licenses(["notice"])
6

7
# Note: TFF code outside this directory can depend on libraries defined in this
8
# directory, but not the other way round. In particular, utility classes and
9
10
# functions that depend on interfaces defined in the Core API belong in `core`,
# and those that deal with TensorFlow belong in `tensorflow_libs`.
11

12
13
14
py_library(
    name = "common_libs",
    srcs = ["__init__.py"],
15
    srcs_version = "PY3",
16
    visibility = ["//tensorflow_federated/tools:__subpackages__"],
17
18
)

19
20
21
22
23
24
25
26
27
28
29
30
py_library(
    name = "golden",
    testonly = True,
    srcs = ["golden.py"],
    srcs_version = "PY3",
)

py_test(
    name = "golden_test",
    size = "small",
    srcs = ["golden_test.py"],
    args = [
31
32
        "--golden",
        "$(location golden_test_goldens/test_check_raises_traceback.expected)",
33
34
35
36
37
38
39
40
        "--golden",
        "$(location golden_test_goldens/test_check_string_fails.expected)",
        "--golden",
        "$(location golden_test_goldens/test_check_string_succeeds.expected)",
        "--golden",
        "$(location golden_test_goldens/test_check_string_updates.expected)",
    ],
    data = [
41
        "golden_test_goldens/test_check_raises_traceback.expected",
42
43
44
45
46
47
48
49
50
        "golden_test_goldens/test_check_string_fails.expected",
        "golden_test_goldens/test_check_string_succeeds.expected",
        "golden_test_goldens/test_check_string_updates.expected",
    ],
    python_version = "PY3",
    srcs_version = "PY3",
    deps = [":golden"],
)

51
52
53
py_library(
    name = "py_typecheck",
    srcs = ["py_typecheck.py"],
54
    srcs_version = "PY3",
55
56
57
58
)

py_test(
    name = "py_typecheck_test",
59
    size = "small",
60
    srcs = ["py_typecheck_test.py"],
61
62
    python_version = "PY3",
    srcs_version = "PY3",
63
64
    deps = [
        ":py_typecheck",
65
        ":structure",
66
    ],
67
)
68

69
70
71
py_library(
    name = "serialization_utils",
    srcs = ["serialization_utils.py"],
72
    srcs_version = "PY3",
73
74
    deps = [
        ":py_typecheck",
75
        "@com_google_protobuf//:protobuf_python",
76
77
78
79
80
81
82
    ],
)

py_test(
    name = "serialization_utils_test",
    size = "small",
    srcs = ["serialization_utils_test.py"],
83
84
    python_version = "PY3",
    srcs_version = "PY3",
85
86
    deps = [
        ":serialization_utils",
87
        "@com_google_protobuf//:protobuf_python",
88
89
    ],
)
90
91

py_library(
Michael Reneer's avatar
Michael Reneer committed
92
93
94
    name = "structure",
    srcs = ["structure.py"],
    srcs_version = "PY3",
95
96
    # TODO(b/163856734): Fix the visibility of the `common_libs`.
    visibility = [
Zachary Garrett's avatar
Zachary Garrett committed
97
        "//intelligence/federated/aggregators:__pkg__",
98
99
100
        "//tensorflow_federated:internal",
        "//tensorflow_federated/python/tests:__pkg__",
    ],
Michael Reneer's avatar
Michael Reneer committed
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
    deps = [":py_typecheck"],
)

py_test(
    name = "structure_test",
    size = "small",
    srcs = ["structure_test.py"],
    python_version = "PY3",
    srcs_version = "PY3",
    deps = [":structure"],
)

py_library(
    name = "test_utils",
    srcs = ["test_utils.py"],
116
    srcs_version = "PY3",
117
118
119
120
121
122
    # TODO(b/163856734): Fix the visibility of the `common_libs`.
    visibility = [
        "//tensorflow_federated:internal",
        "//tensorflow_federated/python/examples/simple_fedavg:__pkg__",
        "//tensorflow_federated/python/tests:__pkg__",
    ],
123
124
)

125
126
127
128
py_library(
    name = "tracing",
    srcs = ["tracing.py"],
    srcs_version = "PY3",
129
130
    # TODO(b/163856734): Fix the visibility of the `common_libs`.
    visibility = ["//tensorflow_federated:internal"],
131
132
133
134
135
136
137
138
139
140
141
    deps = [":py_typecheck"],
)

py_test(
    name = "tracing_test",
    size = "small",
    srcs = ["tracing_test.py"],
    python_version = "PY3",
    srcs_version = "PY3",
    deps = [":tracing"],
)