{"id":31755690,"url":"https://github.com/lgro/pyapsi","last_synced_at":"2025-10-09T19:00:08.926Z","repository":{"id":38404896,"uuid":"480932034","full_name":"LGro/PyAPSI","owner":"LGro","description":"Python wrapper for labeled and unlabeled asymmetric private set intersection (APSI).","archived":false,"fork":false,"pushed_at":"2024-04-12T19:32:35.000Z","size":74,"stargazers_count":17,"open_issues_count":9,"forks_count":8,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-26T05:58:02.608Z","etag":null,"topics":["apsi","cpir","pir","private-information-retrieval","private-set-intersection","psi","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LGro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2022-04-12T18:40:48.000Z","updated_at":"2025-09-17T09:33:58.000Z","dependencies_parsed_at":"2024-04-12T20:48:09.242Z","dependency_job_id":null,"html_url":"https://github.com/LGro/PyAPSI","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/LGro/PyAPSI","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LGro%2FPyAPSI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LGro%2FPyAPSI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LGro%2FPyAPSI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LGro%2FPyAPSI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LGro","download_url":"https://codeload.github.com/LGro/PyAPSI/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LGro%2FPyAPSI/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001866,"owners_count":26083226,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["apsi","cpir","pir","private-information-retrieval","private-set-intersection","psi","python"],"created_at":"2025-10-09T19:00:02.522Z","updated_at":"2025-10-09T19:00:08.917Z","avatar_url":"https://github.com/LGro.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PyAPSI\n\n[![Actions Status](https://github.com/LGro/PyAPSI/workflows/ci-cd-pipeline/badge.svg)](https://github.com/LGro/PyAPSI/actions)\n[![PyPI - Wheel](https://img.shields.io/pypi/wheel/apsi)](https://pypi.org/project/apsi/)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/apsi)](https://pypi.org/project/apsi/)\n[![License: MIT](https://img.shields.io/github/license/LGro/PyAPSI)](https://github.com/LGro/PyAPSI/blob/main/LICENSE)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\nPython wrapper for labeled and unlabeled asymmetric private set intersection\n([APSI](https://github.com/microsoft/apsi)).\n\n**NOTE:** This repository is not actively maintained right now, since my focus has\nshifted away from APSI.\nThe most valuable contribution would be to set up deploying tarballs to PyPI that are\npip installable and build APSI locally to match the available platform extensions.\n\n## Setup\n\nFor `manylinux_2_31_x86_64` compatible platforms you can install `PyAPSI` from\n[PyPi](https://pypi.org/project/apsi/) with\n\n```\npip install apsi\n```\n\nYou can check the system library versions that are required to be\n`manylinux_2_31_x86_64` compatible in the\n[auditwheel policy](https://github.com/pypa/auditwheel/blob/main/src/auditwheel/policy/manylinux-policy.json#L335-L340).\n\nNOTE: While AVX2 supported is currently patched out\n([#11](https://github.com/LGro/PyAPSI/issues/11)), APSI and its dependencies still seem\nto choose optimizations during build time depending on the available CPU flags, which\ncan cause incompatibility of the pre-built wheels on older CPUs beyond what `auditwheel`\ncan identify ([#13](https://github.com/LGro/PyAPSI/issues/13)).\n\nIn case you feel like contributing a build setup for Windows and OSX compatible wheels\nor extend the \"From Source\" section below, I would be happy to review your pull request.\n\n## Example\n\nExample usage of the labeled APSI server and client.\nThe unlabeled variant can be used analogous to this.\n\n```python\nfrom apsi import LabeledServer, LabeledClient\n\napsi_params = \"\"\"\n{\n    \"table_params\": {\n        \"hash_func_count\": 3,\n        \"table_size\": 512,\n        \"max_items_per_bin\": 92\n    },\n    \"item_params\": {\"felts_per_item\": 8},\n    \"query_params\": {\n        \"ps_low_degree\": 0,\n        \"query_powers\": [1, 3, 4, 5, 8, 14, 20, 26, 32, 38, 41, 42, 43, 45, 46]\n    },\n    \"seal_params\": {\n        \"plain_modulus\": 40961,\n        \"poly_modulus_degree\": 4096,\n        \"coeff_modulus_bits\": [40, 32, 32]\n    }\n}\n\"\"\"\n\nserver = LabeledServer()\nserver.init_db(apsi_params, max_label_length=10)\nserver.add_items([(\"item\", \"1234567890\"), (\"abc\", \"123\"), (\"other\", \"my label\")])\n\nclient = LabeledClient(apsi_params)\n\noprf_request = client.oprf_request([\"item\", \"abc\"])\noprf_response = server.handle_oprf_request(oprf_request)\nquery = client.build_query(oprf_response)\nresponse = server.handle_query(query)\nresult = client.extract_result(response)\n\nassert result == {\"item\": \"1234567890\", \"abc\": \"123\"}\n```\n\nTo control multi threading and logging in `APSI` see\n[`apsi.utils`](https://github.com/LGro/PyAPSI/blob/main/apsi/utils.py).\n\n## Building \u0026 Testing\n\n### Docker\n\nBefore you start, make sure that [Taskfile](https://taskfile.dev/#/installation),\n[Docker](https://docs.docker.com/engine/install/) and\n[Poetry](https://python-poetry.org/docs/#installation) are installed.\n\nYou can then run a full build with tests that will generate a wheel file in `dist/` as\nfollows:\n\n```\ntask wheel PYTHON_VERSION=3.10.4\n```\n\nNote: Only Python 3.8, 3.9, 3.10, and their patch versions for which\n[official Python Docker images](https://hub.docker.com/_/python) exist are supported.\n\n### From Source\n\nPlease have a look at the files inside\n[`docker/`](https://github.com/LGro/PyAPSI/tree/main/docker) for the required `vcpkg`\nsetup and `apsi` AVX2 patch, in case you'd like to build from source in a custom\nenvironment.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flgro%2Fpyapsi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flgro%2Fpyapsi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flgro%2Fpyapsi/lists"}