Skip to content
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

Ignore documentation string mismatch in dimension validation #40

Merged
merged 3 commits into from
Jun 13, 2024

Conversation

dhirving
Copy link
Contributor

Users are having trouble running universe v5 -> v6 migrations because of the error generated for mismatched dimension universes. There is a known mismatch of documentation strings in some older repositories that is spuriously throwing an error.

Add a special case to ignore this known mismatch so that users don't have to add special options to complete the migration.

Checklist

  • added documentation for a new migration script

Copy link

codecov bot commented May 24, 2024

Codecov Report

Attention: Patch coverage is 93.10345% with 2 lines in your changes missing coverage. Please review.

Project coverage is 58.68%. Comparing base (0615730) to head (0da4428).
Report is 7 commits behind head on main.

Current head 0da4428 differs from pull request most recent head fe805b7

Please upload reports for the commit fe805b7 to get more accurate results.

Files Patch % Lines
.../lsst/daf/butler_migrate/_dimensions_json_utils.py 71.42% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #40      +/-   ##
==========================================
+ Coverage   55.66%   58.68%   +3.01%     
==========================================
  Files          38       38              
  Lines        1315     1428     +113     
  Branches      281      302      +21     
==========================================
+ Hits          732      838     +106     
- Misses        546      549       +3     
- Partials       37       41       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

dhirving added 2 commits May 24, 2024 15:53
Users are having trouble running universe v5 -> v6 migrations because of the error generated for mismatched dimension universes.  There is a known mismatch of documentation strings in some older repositories that is spuriously throwing an error.

Add a special case to ignore this known mismatch so that users don't have to add special options to complete the migration.
In the new version of uv, they dropped support for the VIRTUAL_ENV environment variable.
@dhirving dhirving force-pushed the tickets/DM-44546 branch from e8eba41 to 0da4428 Compare May 24, 2024 22:53
@dhirving dhirving marked this pull request as ready for review May 24, 2024 22:57
Comment on lines 261 to 274
def _is_expected_diff_line(line: str) -> bool:
# ndiff prefix for matching lines and "hint" lines.
if line.startswith(" ") or line.startswith("? "):
return True

# Lines containing only docstring changes.
if re.match(r'^[-+]\s+"doc":', line):
return True

# Empty line.
if line.strip() == "":
return True

return False
Copy link
Collaborator

Choose a reason for hiding this comment

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

Feels a bit fragile. Would it be better to just ignore doc strings when doing diff (maybe optionally)? You could load JSON from string into dict, drop all doc keys recursively and compare the result.

Copy link
Collaborator

@andy-slac andy-slac left a comment

Choose a reason for hiding this comment

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

Looks good, one potential improvement, but it's up to you.

Instead of trying to filter out doc strings after running the diff, adjust the input to the diff to get the same effect.  This is a little less fragile.
@dhirving dhirving merged commit 0c255e9 into main Jun 13, 2024
10 checks passed
@dhirving dhirving deleted the tickets/DM-44546 branch June 13, 2024 19:06
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.

2 participants