From ad49a18e36ad6aea35886b64712bc647f99e7899 Mon Sep 17 00:00:00 2001 From: Sunny Wu Date: Tue, 14 Oct 2025 15:26:34 +1100 Subject: [PATCH 1/9] Update test files for improved Python dependency management --- tests/test_bidstream_client.py | 2 +- tests/test_client.py | 2 +- tests/test_encryption.py | 2 +- tests/test_refresh_keys_util.py | 2 +- tests/test_sharing.py | 2 +- tests/test_sharing_client.py | 6 +++--- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/test_bidstream_client.py b/tests/test_bidstream_client.py index 463fa8e..5df9b1c 100644 --- a/tests/test_bidstream_client.py +++ b/tests/test_bidstream_client.py @@ -2,7 +2,7 @@ import unittest from unittest.mock import patch -from test_utils import * +from .test_utils import * from uid2_client import BidstreamClient, Uid2Base64UrlCoder, DecryptionStatus, Uid2ClientFactory from uid2_client.refresh_response import RefreshResponse diff --git a/tests/test_client.py b/tests/test_client.py index 84fcef8..73e9ecc 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -1,7 +1,7 @@ import unittest from unittest.mock import patch -from test_utils import * +from .test_utils import * from uid2_client import * from uid2_client.euid_client_factory import EuidClientFactory from uid2_client.refresh_response import RefreshResponse diff --git a/tests/test_encryption.py b/tests/test_encryption.py index f79e651..f971e49 100644 --- a/tests/test_encryption.py +++ b/tests/test_encryption.py @@ -1,6 +1,6 @@ import unittest -from test_utils import * +from .test_utils import * from uid2_client import * _master_secret = bytes([139, 37, 241, 173, 18, 92, 36, 232, 165, 168, 23, 18, 38, 195, 123, 92, 160, 136, 185, 40, 91, 173, 165, 221, 168, 16, 169, 164, 38, 139, 8, 155]) diff --git a/tests/test_refresh_keys_util.py b/tests/test_refresh_keys_util.py index 0ca0059..8eca05c 100644 --- a/tests/test_refresh_keys_util.py +++ b/tests/test_refresh_keys_util.py @@ -3,7 +3,7 @@ from unittest.mock import patch, MagicMock from uid2_client import refresh_keys_util, Uid2Response -from test_utils import * +from .test_utils import * from uid2_client.encryption import _encrypt_gcm, _decrypt_gcm diff --git a/tests/test_sharing.py b/tests/test_sharing.py index 203c292..5a1cfbe 100644 --- a/tests/test_sharing.py +++ b/tests/test_sharing.py @@ -2,7 +2,7 @@ from unittest.mock import patch from uid2_client import * -from test_utils import * +from .test_utils import * import datetime as dt diff --git a/tests/test_sharing_client.py b/tests/test_sharing_client.py index a9e2d3b..f112120 100644 --- a/tests/test_sharing_client.py +++ b/tests/test_sharing_client.py @@ -2,9 +2,9 @@ import unittest from unittest.mock import patch -from test_utils import * -from test_bidstream_client import TestBidStreamClient -from test_encryption import TestEncryptionFunctions +from .test_utils import * +from .test_bidstream_client import TestBidStreamClient +from .test_encryption import TestEncryptionFunctions from uid2_client import SharingClient, DecryptionStatus, Uid2ClientFactory from uid2_client.encryption_status import EncryptionStatus from uid2_client.refresh_response import RefreshResponse From fe40b63d632254fbfe5bf0e41131e24e12f9674f Mon Sep 17 00:00:00 2001 From: Sunny Wu Date: Tue, 14 Oct 2025 15:36:07 +1100 Subject: [PATCH 2/9] Update Python version requirement to >=3.8 - Update pyproject.toml requires-python from >=3.6 to >=3.8 - Update setup.cfg classifiers to remove Python 3.6 and 3.7 support - Add support for Python 3.8, 3.9, 3.10, 3.11, and 3.12 - Update Dockerfile.dev to use Python 3.8 base image This change is necessary because the code uses importlib.metadata which was introduced in Python 3.8, making the previous >=3.6 requirement incorrect and causing import errors on older versions. --- pyproject.toml | 2 +- setup.cfg | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index e08a110..5e90b30 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,7 @@ classifiers = [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", ] -requires-python = ">=3.6" +requires-python = ">=3.8" dependencies = [ "setuptools", "pycryptodome", diff --git a/setup.cfg b/setup.cfg index 31eb46d..63b9cc8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -15,10 +15,11 @@ classifiers = Natural Language :: English Operating System :: OS Independent Programming Language :: Python :: 3 - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.12 Topic :: Internet Topic :: Software Development :: Libraries :: Python Modules Topic :: Utilities From 9726026664a593fc03b887e44a87cf61801dff5b Mon Sep 17 00:00:00 2001 From: Sunny Wu Date: Tue, 14 Oct 2025 17:28:31 +1100 Subject: [PATCH 3/9] Remove setup.py and setup.cfg, fix Docker build - Remove legacy setup.py and setup.cfg files - Update pyproject.toml to configure proper package discovery - Exclude node_modules, tests, examples, and venv from package discovery - Fix Docker build error caused by multiple top-level packages --- pyproject.toml | 4 ++++ setup.cfg | 40 ---------------------------------------- setup.py | 4 ---- 3 files changed, 4 insertions(+), 44 deletions(-) delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/pyproject.toml b/pyproject.toml index 5e90b30..1b2eac0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,6 +5,10 @@ requires = [ ] build-backend = "setuptools.build_meta" +[tool.setuptools.packages.find] +include = ["uid2_client*"] +exclude = ["tests*", "examples*"] + [project] name = "uid2_client" version = "2.7.0" diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 63b9cc8..0000000 --- a/setup.cfg +++ /dev/null @@ -1,40 +0,0 @@ -[metadata] -name = uid2-client -author = UID2 team -author_email = unifiedid-admin@thetradedesk.com -home_page = https://iabtechlab.com -description = Client for working with advertising UID2 services -long_description = file: README.md -long_description_content_type = text/markdown -platform = any -# Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers -classifiers = - Development Status :: 3 - Alpha - Environment :: Console - Intended Audience :: Other Audience - Natural Language :: English - Operating System :: OS Independent - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - Programming Language :: Python :: 3.12 - Topic :: Internet - Topic :: Software Development :: Libraries :: Python Modules - Topic :: Utilities - License :: OSI Approved :: Apache 2.0 - -[options] -zip_safe = true -packages = find: -include_package_data = true - -[options.packages.find] -exclude = examples, tests - -[bdist_wheel] -universal = false - -[sdist] -formats = zip, gztar diff --git a/setup.py b/setup.py deleted file mode 100644 index 1abbd06..0000000 --- a/setup.py +++ /dev/null @@ -1,4 +0,0 @@ -import setuptools - -if __name__ == "__main__": - setuptools.setup() From 45a3504ebe1e99b37571721134e8a892fc820515 Mon Sep 17 00:00:00 2001 From: Sunny Wu Date: Tue, 14 Oct 2025 17:43:59 +1100 Subject: [PATCH 4/9] Add unit tests to CI workflow and clean up dependencies - Add unit-tests job to build-and-test.yaml for Python 3.8 - Keep existing vulnerability-scan job using shared action - Add dev dependencies (pytest, pytest-cov, unittest-xml-reporting) to pyproject.toml - Remove setuptools from runtime dependencies (only needed for build) - Tested locally: 287 tests pass successfully --- .github/workflows/build-and-test.yaml | 25 ++++++++++++++++++++++++- pyproject.toml | 10 ++++++++-- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index 68fe5da..7e5d058 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -2,8 +2,31 @@ name: Build and Test on: [pull_request, push, workflow_dispatch] jobs: - build: + vulnerability-scan: uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-build-and-test.yaml@v3 secrets: inherit with: vulnerability_scan_only: true + + unit-tests: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.8"] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -e .[dev] + + - name: Run unit tests + run: | + python -m unittest tests/*.py diff --git a/pyproject.toml b/pyproject.toml index 1b2eac0..ea91684 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,11 +24,17 @@ classifiers = [ ] requires-python = ">=3.8" dependencies = [ - "setuptools", "pycryptodome", "bitarray" ] -keywords = ["uid2"] + +[project.optional-dependencies] +dev = [ + "pytest", + "pytest-cov", + "unittest-xml-reporting" +] +keywords = ["uid2","euid"] [project.license] file="LICENSE" [project.urls] From 3ec74c36dc452f3262942a142550241b0aca75d1 Mon Sep 17 00:00:00 2001 From: Sunny Wu Date: Tue, 14 Oct 2025 17:48:01 +1100 Subject: [PATCH 5/9] Relax setuptools version constraint - Change from setuptools == 68.2.2 to setuptools < 81 - Allows more flexibility while maintaining compatibility - Keeps setuptools in build-system where it's needed for setuptools.build_meta --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index ea91684..f699236 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [build-system] requires = [ - "setuptools == 68.2.2", + "setuptools < 81", "wheel", ] build-backend = "setuptools.build_meta" From 9efbafea0a91c5b452ac0afc995d4e0fec3e2a73 Mon Sep 17 00:00:00 2001 From: Sunny Wu Date: Tue, 14 Oct 2025 18:00:03 +1100 Subject: [PATCH 6/9] Add unit tests to build-and-publish workflow - Add unit-tests job that runs before build-and-publish - Tests run on Ubuntu with Python 3.8 (same as build-and-test.yaml) - Add needs: unit-tests dependency to ensure tests pass before publishing - Prevents publishing broken code to PyPi - Tested locally: 287 tests pass successfully --- .github/workflows/build-and-publish.yaml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/build-and-publish.yaml b/.github/workflows/build-and-publish.yaml index a55c6ab..2be6c05 100644 --- a/.github/workflows/build-and-publish.yaml +++ b/.github/workflows/build-and-publish.yaml @@ -19,8 +19,32 @@ on: default: 'CRITICAL,HIGH' jobs: + unit-tests: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.8"] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -e .[dev] + + - name: Run unit tests + run: | + python -m unittest tests/*.py + build-and-pubish: name: Build and publish Python packages to PyPi + needs: unit-tests uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-publish-to-pypi-versioned.yaml@v3 with: release_type: ${{ inputs.release_type }} From 2dfe0a9b28bfc4cd03a89ec98c60c867f7faa286 Mon Sep 17 00:00:00 2001 From: Sunny Wu Date: Wed, 15 Oct 2025 11:03:02 +1100 Subject: [PATCH 7/9] Add multi-Python version testing to build-and-test workflow - Test against Python 3.8, 3.9, 3.10, 3.11, 3.12, 3.13 - Ensures compatibility across supported Python versions - Improves test coverage and catches version-specific issues --- .github/workflows/build-and-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index 7e5d058..9f7d625 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.8"] + python-version: ["3.8","3.9","3.10","3.11","3.12","3.13"] steps: - uses: actions/checkout@v4 From 898f1e44164e6b0efe54f7a8789b1943a2bc4fb1 Mon Sep 17 00:00:00 2001 From: Sunny Wu Date: Wed, 15 Oct 2025 11:10:10 +1100 Subject: [PATCH 8/9] run unit tests on multiple python versions in the build-and-publish.yaml github action --- .github/workflows/build-and-publish.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-publish.yaml b/.github/workflows/build-and-publish.yaml index 2be6c05..358652d 100644 --- a/.github/workflows/build-and-publish.yaml +++ b/.github/workflows/build-and-publish.yaml @@ -23,7 +23,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.8"] + python-version: ["3.8","3.9","3.10","3.11","3.12","3.13"] steps: - uses: actions/checkout@v4 From 9fef3f05ed790a67f73287c88ac7b17294f36e2c Mon Sep 17 00:00:00 2001 From: Sunny Wu Date: Thu, 16 Oct 2025 15:05:22 +1100 Subject: [PATCH 9/9] Raised min support from python 3.8 to 3.10 --- .github/workflows/build-and-publish.yaml | 2 +- .github/workflows/build-and-test.yaml | 2 +- Dockerfile.dev | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-and-publish.yaml b/.github/workflows/build-and-publish.yaml index 358652d..f7faeb3 100644 --- a/.github/workflows/build-and-publish.yaml +++ b/.github/workflows/build-and-publish.yaml @@ -23,7 +23,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.8","3.9","3.10","3.11","3.12","3.13"] + python-version: ["3.10","3.11","3.12","3.13"] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index 9f7d625..1033265 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.8","3.9","3.10","3.11","3.12","3.13"] + python-version: ["3.10","3.11","3.12","3.13"] steps: - uses: actions/checkout@v4 diff --git a/Dockerfile.dev b/Dockerfile.dev index 60fe2b6..d3d0530 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -1,3 +1,3 @@ -FROM python:3.8 +FROM python:3.10 COPY . /build RUN pip install --no-cache-dir -e /build[dev]