From 05f927ae3ac341213f7a66606bbe86750c562b9e Mon Sep 17 00:00:00 2001 From: Matthew Grange Date: Mon, 30 Mar 2026 11:33:38 -0700 Subject: [PATCH] Rename PyPI package to privacyguard-platform and extract code_similarity optional extra (#123) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: ## Problem The PyPI package name `PrivacyGuard` needs to be updated to `privacyguard-platform`. Additionally, the tree-sitter and codebleu dependencies require specialized import, so moving them as an optional dependency so "pip install PrivacyGuard" works out of the box ## Changes - Renamed the PyPI package from `PrivacyGuard` to `privacyguard-platform` - Moved tree-sitter grammars, codebleu, and zss into a new `code_similarity` optional extra - Updated the `unittest` extra to include `code_similarity` - Added a CI step to verify the base install works without optional dependencies - Updated the CI install step to use `.[code_similarity]` instead of manually installing codebleu ## Usage - `pip install privacyguard-platform` — base library without code similarity deps - `pip install privacyguard-platform[code_similarity]` — includes tree-sitter/codebleu/zss Differential Revision: D98758423 --- .github/workflows/reusable_test.yml | 10 +++++++--- pyproject.toml | 12 +++++++----- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/reusable_test.yml b/.github/workflows/reusable_test.yml index 52f70b5..627245f 100644 --- a/.github/workflows/reusable_test.yml +++ b/.github/workflows/reusable_test.yml @@ -24,11 +24,15 @@ jobs: with: python-version: ${{ matrix.python-version }} - - name: Install PrivacyGuard library + - name: Verify base install (no optional dependencies) run: | printf 'tree-sitter==0.20.4\nsetuptools<75\n' > /tmp/build-constraints.txt - UV_BUILD_CONSTRAINT=/tmp/build-constraints.txt uv pip install codebleu==0.6.0 - uv pip install -e . + UV_BUILD_CONSTRAINT=/tmp/build-constraints.txt uv pip install -e . + python -c "import privacy_guard; print('Base install OK')" + + - name: Install PrivacyGuard library with code_similarity + run: | + UV_BUILD_CONSTRAINT=/tmp/build-constraints.txt uv pip install -e ".[code_similarity]" - name: Tests and coverage run: | diff --git a/pyproject.toml b/pyproject.toml index 2c88410..79066ec 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,11 +3,10 @@ requires = ["setuptools>=34.4", "wheel", "setuptools_scm"] build-backend = "setuptools.build_meta" [project] -name = "PrivacyGuard" +name = "privacyguard-platform" description = "PrivacyGuard platform for Privacy Attacks and Analysis. Perform privacy analyses of ML models using Inference Attacks and Extraction Attacks." authors = [{name = "Meta Platforms, Inc."}] -license = "Apache-2.0" -license-files = ["LICENSE"] +license = {text = "Apache-2.0"} readme = "README.md" requires-python = ">=3.10" keywords = ["PrivacyGuard", "Privacy", "Privacy Attack", "Privacy Analysis", "privacy_guard"] @@ -41,6 +40,10 @@ dependencies = [ 'later', 'torchvision', 'matplotlib', +] + +[project.optional-dependencies] +code_similarity = [ 'tree-sitter==0.20.4', 'tree-sitter-python<=0.23.2', 'tree-sitter-c', @@ -56,7 +59,6 @@ dependencies = [ 'zss', ] -[project.optional-dependencies] dev = [ "beautifulsoup4", "Jinja2", @@ -76,7 +78,7 @@ unittest_minimal = [ ] unittest = [ - "privacy-guard[dev,notebook,unittest_minimal]", + "privacyguard-platform[dev,notebook,unittest_minimal,code_similarity]", ] tutorial = [