Dict-like metadata interface & private metadata#260
Open
yfukai wants to merge 4 commits intoroyerlab:mainfrom
Open
Dict-like metadata interface & private metadata#260yfukai wants to merge 4 commits intoroyerlab:mainfrom
yfukai wants to merge 4 commits intoroyerlab:mainfrom
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #260 +/- ##
==========================================
- Coverage 88.18% 87.87% -0.32%
==========================================
Files 56 56
Lines 4308 4378 +70
Branches 749 758 +9
==========================================
+ Hits 3799 3847 +48
- Misses 319 339 +20
- Partials 190 192 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Solves #192
This pull request refactors the metadata API for graph backends, introducing a new
MetadataViewclass to provide a dictionary-like interface for metadata that synchronizes mutations directly with the graph.Metadata API udpate:
MetadataViewclass insrc/tracksdata/graph/_base_graph.py, which provides a dictionary-like interface for metadata and ensures that updates, removals, and other mutations are synchronized with the graph backend. This replaces the previousmetadata()andupdate_metadata()methods.BaseGraphclass and its subclasses to expose metadata via themetadataproperty (public) and_private_metadataproperty (private), with enforced validation to prevent accidental modification of private metadata from public APIs. Backend-specific methods for updating and removing metadata are now internal (_update_metadata,_remove_metadata).Private metadata handling and validation:
_private_metadataproperty for internal use. A new test ensures that private metadata is hidden from public APIs and that validation errors are raised for improper access.API and import changes:
src/tracksdata/graph/__init__.pyto exportMetadataViewand reflect the new API, ensuring consistent imports and usage across the package.