Skip to content

Commit

Permalink
0.1.0rc0 release plus minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
justin1121 committed Jun 23, 2020
1 parent f5b808f commit 94ea4d4
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 23 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ jobs:
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: capeprivacy/cape-python
tag_with_ref: true
3 changes: 2 additions & 1 deletion cape_privacy/pandas/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from cape_privacy.pandas import dtypes
from cape_privacy.pandas import registry
from cape_privacy.pandas import transformations
from cape_privacy.pandas.transformer import transformer

__all__ = ["dtypes", "transformations", "transformer"]
__all__ = ["dtypes", "transformations", "transformer", "registry"]
2 changes: 2 additions & 0 deletions cape_privacy/spark/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def is_available():
from cape_privacy.spark import dtypes
from cape_privacy.spark import transformations
from cape_privacy.spark.transformer import transformer
from cape_privacy.spark import registry

def is_available():
return True
Expand All @@ -24,6 +25,7 @@ def is_available():
"is_available",
"transformations",
"transformer",
"registry",
]

del importlib
4 changes: 2 additions & 2 deletions examples/simple_transformation.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import pandas as pd
import numpy as np

import cape_privacy.pandas as cape
import cape_privacy as cape

df = pd.DataFrame(np.ones(5,), columns=["value"])

policy = cape.parse_policy("perturb_value_field.yaml")
df = cape.apply_policy([policy], df)
df = cape.apply_policy(policy, df)

print(df.head())
2 changes: 1 addition & 1 deletion examples/spark_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
rounding_spec = policy.transformations[0]
type_arg = getattr(dtypes, rounding_spec.args['dtype'])
rounding_spec.args['dtype'] = type_arg
rounder = tfms.Rounding(**rounding_spec.args)
rounder = tfms.NumericRounding(**rounding_spec.args)
df = df.select(rounder(functions.col('value')))
df.show()
24 changes: 9 additions & 15 deletions examples/spark_round.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
label: spark-round-float
version: 1
transformations:
- name: roundToZero
type: roundNumeric
args:
dtype:
value: Float
precision:
value: 0
spec:
label: spark-round-float
rules:
- target: records::creditcards.transactions
action: read
effect: allow
transformations:
- field: value
named: roundFloat
version: 1
dtype: Float
precision: 0
rules:
- match:
name: value
actions:
- transform:
name: roundFloat
2 changes: 1 addition & 1 deletion examples/tutorials/apply_policy_on_pandas_df.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
policy = cape_privacy.parse_policy("mask_personal_information.yaml")
# Apply the policy to the DataFrame
# [NOTE] will be updated to `cape_privacy.apply_policy` #49 is merged
df = cape_privacy.pandas.policy.apply_policies([policy], df)
df = cape_privacy.apply_policy(policy, df)
# Output the masked dataset
print("Masked Dataset:")
print(df.head())
2 changes: 1 addition & 1 deletion examples/tutorials/apply_policy_on_spark_df.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
policy = cape_privacy.parse_policy("mask_personal_information.yaml")
# Apply the policy to the DataFrame
# [NOTE] will be updated to `cape_privacy.apply_policy` #49 is merged
df = cape_privacy.spark.policy.apply_policies([policy], df)
df = cape_privacy.apply_policy(policy, df)
# Output the masked dataset
print("Masked Dataset:")
print(df.show())
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import setuptools

setuptools.setup(
name="cape_privacy",
version="0.0.1",
name="cape-privacy",
version="0.1.0rc0",
packages=setuptools.find_packages(),
python_requires=">=3.6",
license="Apache License 2.0",
Expand Down

0 comments on commit 94ea4d4

Please sign in to comment.