Skip to content

Commit 09b7aad

Browse files
authored
Update version to 0.2.1rc5 and remove hard dependency to dp_accounting (#485)
1 parent 6e922ad commit 09b7aad

File tree

8 files changed

+31
-14
lines changed

8 files changed

+31
-14
lines changed

analysis/parameter_tuning.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,10 @@ def _find_candidate_parameters(
142142
if calculate_sum_per_partition_param:
143143
if hist.linf_sum_contributions_histogram.bins[0].lower >= 0:
144144
logging.warning(
145-
"max_sum_per_partition should not contain negative sums because min_sum_per_partition tuning is not supported yet and therefore tuning for max_sum_per_partition works only when linf_sum_contributions_histogram does not negative sums"
146-
)
145+
"max_sum_per_partition should not contain negative sums because"
146+
" min_sum_per_partition tuning is not supported yet and "
147+
"therefore tuning for max_sum_per_partition works only when "
148+
"linf_sum_contributions_histogram does not negative sums")
147149

148150
if calculate_l0_param and calculate_linf_count:
149151
l0_bounds, linf_bounds = _find_candidates_parameters_in_2d_grid(

pipeline_dp/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@
3838
from pipeline_dp.pipeline_backend import PipelineBackend
3939
from pipeline_dp.pipeline_backend import SparkRDDBackend
4040

41-
__version__ = '0.2.1rc4'
41+
__version__ = '0.2.1rc5'

pipeline_dp/budget_accounting.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@
3232
pass
3333

3434

35+
def _check_pldlib_imported() -> bool:
36+
import sys
37+
return "dp_accounting.pld.privacy_loss_distribution" in sys.modules
38+
39+
3540
@dataclass
3641
class MechanismSpec:
3742
"""Specifies the parameters for a DP mechanism.
@@ -446,6 +451,13 @@ def __init__(self,
446451
super().__init__(total_epsilon, total_delta, num_aggregations,
447452
aggregation_weights)
448453

454+
if not _check_pldlib_imported():
455+
raise ImportError("dp_accounting library is not imported. It is"
456+
"required for using PLD budget accounting. "
457+
"Please install dp_accounting library or use"
458+
"NaiveBudgetAccountant instead of "
459+
"PLDBudgetAccountant")
460+
449461
self.minimum_noise_std = None
450462
self._pld_discretization = pld_discretization
451463

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "pipeline-dp"
3-
version = "0.2.1rc4"
3+
version = "0.2.1rc5"
44
description = ""
55
authors = ["Chinmay Shah <[email protected]>", "Vadym Doroshenko <[email protected]>"]
66
license = "Apache-2.0"
@@ -9,7 +9,6 @@ license = "Apache-2.0"
99
python = "^3.8, < 3.12"
1010
python-dp = "^1.1.4"
1111
numpy = "^1.20.1"
12-
dp_accounting = "^0.4.2"
1312

1413
[tool.poetry.dev-dependencies]
1514
yapf = "^0.32.0"

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 0.2.1rc4
2+
current_version = 0.2.1rc5
33
commit = True
44
tag = True
55

setup.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
install_requires = \
1212
['numpy>=1.20.1,<2.0.0',
1313
'python-dp>=1.1.4',
14-
'scipy>=1.7.3,<2.0.0',
15-
'dp_accounting>=0.4.2'
14+
'scipy>=1.7.3,<2.0.0'
1615
]
1716

1817

@@ -22,7 +21,7 @@ def read(fname):
2221

2322
setup_kwargs = {
2423
'name': 'pipeline-dp',
25-
'version': '0.2.1rc4',
24+
'version': '0.2.1rc5',
2625
'description': 'Framework for applying differential privacy to large datasets using batch processing systems',
2726
'author': 'Chinmay Shah',
2827
'author_email': '[email protected]',

tests/budget_accounting_test.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,8 @@ def test_not_enough_aggregations(self, use_num_aggregations):
196196
budget_accountant.compute_budgets()
197197

198198

199-
@unittest.skipIf(
200-
sys.version_info.major == 3 and sys.version_info.minor == 8,
201-
"There are some problems with dp_accounting library in python 3.8")
199+
@unittest.skipIf(sys.version_info.major == 3 and sys.version_info.minor <= 8,
200+
"dp_accounting library only support python >=3.9")
202201
class PLDBudgetAccountantTest(unittest.TestCase):
203202

204203
def test_noise_not_calculated(self):

tests/dp_engine_test.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,8 +1094,8 @@ def run_e2e_private_partition_selection_large_budget(self, col, backend):
10941094
return col
10951095

10961096
@unittest.skipIf(
1097-
sys.version_info.major == 3 and sys.version_info.minor == 8,
1098-
"There are some problems with dp_accounting library in python 3.8")
1097+
sys.version_info.major == 3 and sys.version_info.minor <= 8,
1098+
"dp_accounting library only support python >=3.9")
10991099
@parameterized.parameters(False, True)
11001100
def test_run_e2e_count_public_partition_local(self, pld_accounting):
11011101
Accountant = pipeline_dp.PLDBudgetAccountant if pld_accounting else pipeline_dp.NaiveBudgetAccountant
@@ -1224,6 +1224,9 @@ def test_min_max_sum_per_partition(self):
12241224
self.assertLen(output, 1)
12251225
self.assertAlmostEqual(output[0][1].sum, -3, delta=0.1)
12261226

1227+
@unittest.skipIf(
1228+
sys.version_info.major == 3 and sys.version_info.minor <= 8,
1229+
"dp_accounting library only support python >=3.9")
12271230
def test_pld_not_supported_metrics(self):
12281231
with self.assertRaisesRegex(
12291232
NotImplementedError,
@@ -1237,6 +1240,9 @@ def test_pld_not_supported_metrics(self):
12371240
engine.aggregate([1], aggregate_params,
12381241
self._get_default_extractors(), public_partitions)
12391242

1243+
@unittest.skipIf(
1244+
sys.version_info.major == 3 and sys.version_info.minor <= 8,
1245+
"dp_accounting library only support python >=3.9")
12401246
def test_pld_not_support_private_partition_selection(self):
12411247
with self.assertRaisesRegex(
12421248
NotImplementedError,

0 commit comments

Comments
 (0)