Skip to content

Conversation

@sunnywu
Copy link
Contributor

@sunnywu sunnywu commented Oct 14, 2025

1. Python Version & Dependency Updates

  • Minimum Python Version Raised: The required Python version was updated from >=3.6 to >=3.10. This change was necessary because the code uses importlib.metadata, which was introduced in Python 3.8, fixing import errors on older versions.
  • Version Support Modified: Classifiers were updated to remove support for end-of-life Python 3.6-3.9, while explicitly adding support for Python 3.10+
  • Dependency Constraint Relaxed: The version constraint for setuptools was relaxed from a fixed version (== 68.2.2) to a broader range (< 81), increasing flexibility while maintaining compatibility.

2. Modernizing Package Configuration

  • Removed Legacy Files: The legacy Python packaging files, setup.py and setup.cfg, were removed.
  • Adopted pyproject.toml: The pyproject.toml file was updated to configure proper package discovery, marking a shift to a modern Python packaging standard.
  • Build Fixes: Fixed a Docker build error caused by multiple top-level packages and updated Dockerfile.dev to use a Python 3.10 base image.
  • Excluded Directories: Directories like node_modules, tests, examples, and venv are now explicitly excluded from package discovery.

3. CI and Testing Enhancements

  • Unit Tests Added to CI: A new unit-tests job was added to the Continuous Integration workflow (build-and-test.yaml).
  • Pre-Publish Test Gate: A dependency was added to the build-and-publish workflow to ensure unit tests pass before publishing to PyPI, preventing broken code from being released.
  • Development Dependencies Updated: Development dependencies (e.g., pytest, pytest-cov, unittest-xml-reporting) were added to pyproject.toml.
  • Test Confirmation: The developer confirmed locally that 287 tests pass successfully with these changes.

- 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.
- 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
- 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
- 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
@sunnywu sunnywu marked this pull request as ready for review October 14, 2025 06:49
- 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
@sunnywu sunnywu changed the title Syw UI d2 6085 improve python dependency Syw UID2 6085 improve python dependency Oct 14, 2025
unit-tests:
runs-on: ubuntu-latest
strategy:
matrix:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we use matrix here 🤔

Copy link
Contributor Author

@sunnywu sunnywu Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so we could define a range of setups to run unit tests on, e.g. like below i extended to not just run unit tests on py 3.8 but 3.9/3.10/etc add test coverage, like this run:

https://github.com/IABTechLab/uid2-client-python/actions/runs/18513552871

- 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
@sunnywu sunnywu merged commit bee2d41 into main Oct 16, 2025
11 checks passed
@sunnywu sunnywu deleted the syw-UID2-6085-improve-python-dependency branch October 16, 2025 04:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants