blob: 763feb6d015ee68c9fc932c7ec9bbc08aa10b319 [file] [log] [blame]
#
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Accountant using Privacy Loss Distributions (PLD).
load("@accounting_py_pip_deps//:requirements.bzl", "requirement")
package(default_visibility = [
"//visibility:public",
])
licenses(["notice"])
py_library(
name = "pld",
srcs = ["__init__.py"],
deps = [":pld_privacy_accountant"],
)
py_library(
name = "pld_privacy_accountant",
srcs = ["pld_privacy_accountant.py"],
deps = [
":privacy_loss_distribution",
"//dp_accounting:dp_event",
"//dp_accounting:privacy_accountant",
],
)
py_test(
name = "pld_privacy_accountant_test",
srcs = ["pld_privacy_accountant_test.py"],
deps = [
":pld_privacy_accountant",
"//dp_accounting:dp_event",
"//dp_accounting:privacy_accountant_test",
requirement("absl-py"),
],
)
py_library(
name = "common",
srcs = [
"common.py",
],
srcs_version = "PY3",
deps = [
requirement("numpy"),
requirement("scipy"),
],
)
py_library(
name = "pld_pmf",
srcs = [
"pld_pmf.py",
],
srcs_version = "PY3",
deps = [
":common",
requirement("numpy"),
requirement("scipy"),
],
)
py_test(
name = "common_test",
size = "small",
srcs = ["common_test.py"],
python_version = "PY3",
deps = [
":common",
":test_util",
requirement("absl-py"),
requirement("numpy"),
],
)
py_test(
name = "pld_pmf_test",
size = "small",
srcs = ["pld_pmf_test.py"],
python_version = "PY3",
deps = [
":common",
":pld_pmf",
":test_util",
requirement("absl-py"),
requirement("numpy"),
],
)
py_library(
name = "privacy_loss_distribution",
srcs = [
"privacy_loss_distribution.py",
],
srcs_version = "PY3",
deps = [
":common",
":pld_pmf",
":privacy_loss_mechanism",
requirement("numpy"),
],
)
py_test(
name = "privacy_loss_distribution_test",
size = "small",
srcs = ["privacy_loss_distribution_test.py"],
python_version = "PY3",
deps = [
":common",
":pld_pmf",
":privacy_loss_distribution",
":test_util",
requirement("absl-py"),
requirement("scipy"),
],
)
py_library(
name = "privacy_loss_mechanism",
srcs = [
"privacy_loss_mechanism.py",
],
srcs_version = "PY3",
deps = [
":common",
requirement("numpy"),
requirement("scipy"),
],
)
py_test(
name = "privacy_loss_mechanism_test",
size = "small",
srcs = ["privacy_loss_mechanism_test.py"],
python_version = "PY3",
deps = [
":common",
":privacy_loss_mechanism",
":test_util",
requirement("absl-py"),
requirement("scipy"),
],
)
py_library(
name = "accountant",
srcs = [
"accountant.py",
],
srcs_version = "PY3",
deps = [
":common",
":privacy_loss_distribution",
":privacy_loss_mechanism",
requirement("scipy"),
],
)
py_test(
name = "accountant_test",
size = "small",
srcs = ["accountant_test.py"],
python_version = "PY3",
deps = [
":accountant",
":common",
":privacy_loss_mechanism",
requirement("absl-py"),
],
)
py_library(
name = "test_util",
srcs = [
"test_util.py",
],
srcs_version = "PY3",
deps = [requirement("numpy")],
)
py_test(
name = "test_util_test",
size = "small",
srcs = ["test_util_test.py"],
python_version = "PY3",
deps = [
":test_util",
requirement("absl-py"),
],
)
py_binary(
name = "privacy_loss_distribution_basic_example",
srcs = [
"privacy_loss_distribution_basic_example.py",
],
python_version = "PY3",
deps = [
":privacy_loss_distribution",
requirement("absl-py"),
],
)