diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 4b511f7..431a90f 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -15,11 +15,13 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] - metasyn-version: [ "git+https://github.com/sodascience/metasyn.git@main"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] + metasyn-version: [ "git+https://github.com/sodascience/metasyn.git@develop"] include: - python-version: "3.11" metasyn-version: "metasyn==1.0.1" + - python-version: "3.11" + metasyn-version: "metasyn==1.1.0" steps: - uses: actions/checkout@v4 diff --git a/metasyncontrib/disclosure/privacy.py b/metasyncontrib/disclosure/privacy.py index 1a03ddb..eaec607 100644 --- a/metasyncontrib/disclosure/privacy.py +++ b/metasyncontrib/disclosure/privacy.py @@ -25,3 +25,31 @@ def __init__(self, partition_size: int = 11): def to_dict(self) -> dict: """Create a dictionary that gives the privacy type, and parameters.""" return {"name": self.name, "parameters": {"partition_size": self.partition_size}} + + def comment(self, var): + """Comment on a specific variable in the .toml GMF file. + + Parameters + ---------- + var + Variable to create a comment about. + + Returns + ------- + A string with the comment. + + """ + base_msg = ( + f"The above parameters for column '{var.name}' were generated using disclosure " + f"control\n# with a maximum dominance of 0.5 and data aggregated into partitions of " + f"size {self.partition_size}\n" + f"# before any parameters of the distribution were estimated.") + + intersect_lower = set(("lower", "upper")).intersection( # noqa: C405 + var.distribution.to_dict()["parameters"]) + if len(intersect_lower) > 0: + base_msg = base_msg[:-1] + base_msg += (f"\n# The parameter(s) {', '.join(intersect_lower)} were estimated by the" + f" average of the {self.partition_size} lowest or highest values.") + + return base_msg diff --git a/pyproject.toml b/pyproject.toml index ea51e7e..98dda33 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,13 +20,14 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Development Status :: 3 - Alpha", "License :: OSI Approved :: MIT License", ] dependencies = [ "metasyn>=1.0.1", "polars", - "numpy>=1.20,<2.0", + "numpy>=1.20", ] dynamic = ["version"]