-
-
Notifications
You must be signed in to change notification settings - Fork 4
support deps_path and params_path in dataclass dependencies
#915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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 support for excluding dataclass fields marked with FieldTypes.PARAMS_PATH and FieldTypes.DEPS_PATH when converting objects for YAML output, and it updates tests to validate the new behavior.
- Excludes fields with specific metadata when converting dataclass instances to dictionaries.
- Updates DVC, params, and JSON configuration tests to reflect the new exclusion logic.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| zntrack/plugins/dvc_plugin/init.py | Added logic to filter out fields using PARAMS_PATH/DEPS_PATH metadata and updated stage creation logic. |
| tests/files/zntrack_config/dataclass_w_deps_params_path.json | Updated configuration to match the new exclusion behavior. |
| tests/files/test_dataclass_w_deps_params_path.py | Added new tests to verify proper handling of deps_path and params_path in dataclass models. |
| tests/files/params_config/dataclass_w_deps_params_path.yaml | Updated params YAML to reflect the changes in dataclass conversion. |
| tests/files/dvc_config/dataclass_w_deps_params_path.yaml | Updated DVC YAML to support the new dependency path behavior. |
Comments suppressed due to low confidence (1)
zntrack/plugins/dvc_plugin/init.py:88
- [nitpick] The loop variable 'f' could be renamed to 'field_name' for improved clarity.
for f in exclude_fields:
…ZnTrack into deps_params_path_in_dc
for more information, see https://pre-commit.ci
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## main #915 +/- ##
==========================================
+ Coverage 88.87% 89.01% +0.14%
==========================================
Files 36 36
Lines 2067 2085 +18
==========================================
+ Hits 1837 1856 +19
+ Misses 230 229 -1 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this 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 enhances support for dataclass dependencies by adding specialized handling for parameters and dependency paths and updating related documentation and tests.
- Introduces _dataclass_to_dict to filter out fields with params_path and deps_path.
- Updates conversion methods to use the new helper, fixes an error message typo, and adjusts tests to validate wrong field usage.
- Updates documentation with examples supporting params_path and deps_path.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| zntrack/plugins/dvc_plugin/init.py | Added _dataclass_to_dict with filtering for field types and fixed typo in error message. |
| tests/integration/test_deps_dataclass.py | Updated tests for handling wrong field initialization and naming of test classes. |
| tests/files/zntrack_config/dataclass_w_deps_params_path.json | Added configuration file for nodes using dataclass deps_path and params_path. |
| tests/files/test_dataclass_w_deps_params_path.py | Added tests for models with parameters and dependency paths in dataclasses. |
| tests/files/params_config/dataclass_w_deps_params_path.yaml | Added params configuration reflecting the new dataclass support. |
| tests/files/dvc_config/dataclass_w_deps_params_path.yaml | Added DVC stages configuration that integrates new deps_path and params_path behavior. |
| docs/source/node_details.rst | Updated documentation to include examples for params_path and deps_path usage. |
Comments suppressed due to low confidence (1)
zntrack/plugins/dvc_plugin/init.py:37
- Avoid using 'object' as a parameter name since it shadows the built-in type; consider renaming it to 'obj'.
def _dataclass_to_dict(object) -> dict:
node.outs_pathin dcdeps_path?