{"id":28385512,"url":"https://github.com/kiprotect/dwork","last_synced_at":"2025-06-26T06:31:24.655Z","repository":{"id":57424733,"uuid":"310307625","full_name":"kiprotect/dwork","owner":"kiprotect","description":"A Python library for anonymous data science and analytics that uses differential privacy (DP) and similar privacy-enhancing technologies to protect personal or sensitive data.","archived":false,"fork":false,"pushed_at":"2024-07-09T21:59:46.000Z","size":399,"stargazers_count":10,"open_issues_count":0,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-29T18:08:58.277Z","etag":null,"topics":["differential-privacy","pandas","privacy","privacy-enhancing-technologies","privacy-tools","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kiprotect.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-05T13:27:51.000Z","updated_at":"2025-03-18T08:08:59.000Z","dependencies_parsed_at":"2024-07-10T02:09:48.573Z","dependency_job_id":"faa3a380-2ff7-4ca8-8167-5936ad4d8215","html_url":"https://github.com/kiprotect/dwork","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/kiprotect/dwork","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiprotect%2Fdwork","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiprotect%2Fdwork/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiprotect%2Fdwork/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiprotect%2Fdwork/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kiprotect","download_url":"https://codeload.github.com/kiprotect/dwork/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiprotect%2Fdwork/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262014493,"owners_count":23245138,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["differential-privacy","pandas","privacy","privacy-enhancing-technologies","privacy-tools","python"],"created_at":"2025-05-30T10:40:25.635Z","updated_at":"2025-06-26T06:31:24.648Z","avatar_url":"https://github.com/kiprotect.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"**Attention: This is still an early version just for testing, do not use it in production yet.**\n\n# Dwork\n\nDwork is a Python toolkit for anonymous data science \u0026 analytics. It leverages modern privacy concepts like differential privacy (DP) to anonymize sensitive and personal data on the fly while making it (hopefully) easy to work with this data. Dwork can be freely used, it is released under the BSD-3 license.\n\n## Installing\n\nYou can install the latest Dwork version using pip:\n\n    pip install dwork\n\nAlternatively, you can download this repository and install Dwork directly from the main directory of the repository:\n\n    pip install .\n\n## Quick Example\n\nTo learn more about how to use Dwork for anonymous data science, please have a look at the `examples` directory and our [documentation](https://kiprotect.com/docs/dwork) (coming soon). As a start, here's a quick and simple example:\n\nWe first load a CSV file using Dworks' pandas interface:\n\n```python\nfrom dwork.dataset.pandas import PandasDataset\nfrom dwork.dataschema import DataSchema\nfrom dwork.ast.types import Integer\n\nclass AbsenteeismSchema(DataSchema):\n    Weight = Integer(min=0, max=200)\n    Height = Integer(min=0, max=200)\n\nfilename = f\"absenteeism_at_work.csv\"\ndf = pd.read_csv(filename, sep=\";\")\nds = PandasDataset(AbsenteeismSchema, df)\n```\n\nHere we have also defined a schema for the dataset, which is necessary to tell Dwork about the data types and their ranges. Dwork uses that information to e.g. calculate sensitivities and apply proper random noise to the results of our analyses.\n\nThe loaded dataset can then be used almost like a normal dataframe. For example, the expression\n\n```python\n(ds[\"Weight\"].sum()/ds.len()).dp(0.5)\n```\n\nreturns the mean weight of our dataset using a differentially private (DP) mechanism with a privacy factor `epsilon=0.5`. Here, Dwork automatically calculates the sensitivity and the required amount of noise that needs to be added to the result of the calculation in order to achieve 0.5-DP. Neat, isn't it?\n\nRight now Dwork already supports basic operations like addition, multiplication and division on types like integers and floats. It can also perform basic aggregation operations on arrays of these values, like calculating sums or lengths. In addition, Dworks' internal semantics and type system make it easy to add new data types and expressions.\n\n# Information For Developers\n\nIf you want to work on Dwork itself, you can install the package in development mode, which will not copy files but instead link them to your virtual environment so that you can edit them and see changes immediately:\n\n    pip install -e .\n\nIf you want to run tests, please also install test dependencies and a virtual environment:\n\n    make setup\n\nThe following sections are only relevant for developers of Dwork, if you are a user you can disregard them.\n\n## Running tests\n\nDwork comes with automated code formatting via black, static type analysis via mypy and testing via py.test / unittest. You can run all of the above with a single make command:\n\n    make\n\nTo only run tests, simply run\n\n    make test\n\nYou can also pass arguments to py.test via the `testargs` parameter:\n\n    make test testargs=\"-x -k TestDatapoints\"\n\n## Upgrading packages\n\nYou can use the fabulous `pur` tool to upgrade packages in the requirements files:\n\n    # will update normal requirements\n    pur -v -r requirements.txt\n    # will update test requirements\n    pur -v -r requirements-test.txt\n\n## Building Wheels\n\nWe install all packages from local wheels if possible (for security reasons), to generate these wheels simply use the following commands:\n\n    pip wheel --wheel-dir wheels -r requirements.txt\n    pip wheel --wheel-dir wheels -r requirements-test.txt\n\n## Making a New Release\n\nTo release a new version of Dwork, follow these steps:\n\n* Make sure all tests pass for the new release.\n* Update `setup.py` with the new version number. We follow the\n  [semantic versioning](https://semver.org/) standard for our version\n  numbers.\n* Add a changelog entry in the `README.md`.\n* Commit the updated `setup.py` and `README.md` files to the repository.\n* Create a new tag with the version number (which is required for CI integration):\n\n      git tag -a v0.1.4 -m \"v0.1.4\"\n* Push the tag to the main repository together with the commit\n\n      git push origin master --tags\n* Gitlab/Travis will pick up the version tag and make the release for us.\n* Alternatively, you can create the distribution packages using `setup.py`:\n\n      python setup.py sdist bdist_wheel\n* You can also manually publish the packages to PyPi via Twine (not recommended):\n  \n      twine upload dist/*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkiprotect%2Fdwork","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkiprotect%2Fdwork","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkiprotect%2Fdwork/lists"}