Skip to content

Conversation

@kunkunlin1221
Copy link
Collaborator

@kunkunlin1221 kunkunlin1221 commented Aug 29, 2025

This pull request introduces significant improvements to the JSON serialization and deserialization capabilities of the pyface library, particularly for face-related objects. It adds from_json class methods to core dataclasses, refines encoding/decoding logic for image and numpy data, and ensures compatibility with updated dependencies. Additionally, a new test verifies the correctness of the JSON (de)serialization process.

Enhancements to JSON (de)serialization:

  • Added from_json class methods to key dataclasses (Eye, Mouth, WhetherOrNot, Liveness, TDDFA, Encode, Who, Attribute, Face, Faces), enabling robust and consistent deserialization from JSON for all face-related objects. [1] [2] [3] [4] [5]
  • Improved encoding and decoding logic for image and numpy array fields in Face and related classes, standardizing the use of capybara utility functions for base64 conversions. [1] [2]
  • Updated the regular expression in the release workflow to more robustly handle version string replacements in pyface/__init__.py.

Dependency and compatibility updates:

  • Increased minimum required version of capybara-docsaid to 0.12.0 in pyproject.toml to ensure compatibility with new features.
  • Removed unused pybase64 import from pyface/object.py since base64 operations are now handled by capybara.

Testing improvements:

  • Added a comprehensive test (tests/test_jsonable.py) to verify that face data can be serialized to JSON and accurately reconstructed, ensuring data integrity for the new from_json methods.

Minor bug fixes:

  • Corrected a field name from lmk68pt to lmk3d68pt in both the TDDFA dataclass and its usage in face_service.py for consistency. [1] [2]
  • Minor code cleanup in face_service.py for improved readability.

Copilot AI review requested due to automatic review settings August 29, 2025 03:45
@kunkunlin1221 kunkunlin1221 added the bug Something isn't working label Aug 29, 2025
@kunkunlin1221 kunkunlin1221 self-assigned this Aug 29, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds face attributes functionality to the pyface library. It updates dependencies, improves JSON serialization for face objects, and adds comprehensive testing for the new jsonable functionality.

  • Update capybara-docsaid dependency to version 0.12.0 or higher
  • Enhance JSON serialization by replacing custom base64 encoding with capybara utility functions
  • Add comprehensive test suite for face object JSON serialization functionality

Reviewed Changes

Copilot reviewed 5 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/test_jsonable.py New test file for validating face object JSON serialization with parametrized test cases
pyproject.toml Updates dependency requirement for capybara-docsaid to minimum version 0.12.0
pyface/object.py Replaces custom base64 encoding with capybara utility functions and adds jsonable functions for new fields
pyface/face_service.py Minor formatting cleanup removing unnecessary blank line
.github/workflows/release.yml Improves version bumping regex pattern to be more robust

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@kunkunlin1221 kunkunlin1221 force-pushed the feat/add_face_attributes branch from ba70b5f to 0d340aa Compare August 29, 2025 04:17
@kunkunlin1221 kunkunlin1221 merged commit 293d265 into main Aug 29, 2025
9 checks passed
@kunkunlin1221 kunkunlin1221 deleted the feat/add_face_attributes branch August 29, 2025 04:24
@kunkunlin1221 kunkunlin1221 changed the title Feat/add_face_attributes Add face attributes and fix jsonable by updating capybara-docsaid to 0.12.0 Aug 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants