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

Allow for reading measure scripts generated with FINESSE v2.0.0 #742

Merged
merged 2 commits into from
Dec 13, 2024

Conversation

alexdewar
Copy link
Collaborator

@alexdewar alexdewar commented Dec 11, 2024

Description

I was hoping that by adding a version field to measure scripts and hardware sets for this next release we could ensure that that field is always present, but it seems like Jon has been doing quite a lot of testing with v2.0.0 (quite reasonably!) so he already has some measure scripts that don't have this field. I don't want him to have to put up with error messages when he upgrades, so let's just assume that measure scripts without a version are version 1. At least going forward we will have this field.

(NB: This isn't a problem for hardware sets, because those are currently all bundled with FINESSE, though we will have user-generated ones in future: #393.)

Fixes #741.

Type of change

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Documentation (non-breaking change that adds or improves the documentation)
  • Optimisation (non-breaking, back-end change that speeds up the code)

Key checklist

  • Pre-commit hooks run successfully (pre-commit run -a)
  • All tests pass (pytest)
  • The documentation builds without warnings (mkdocs build -s)
  • Check the GUI still works (if relevant)
  • Check the code works with actual hardware (if relevant)
  • Check the pyinstaller-built executable works (if relevant)

Further checks

  • Code is commented, particularly in hard-to-understand areas
  • Tests have been added or an issue has been opened to tackle that in the future. (Indicate issue here: # (issue))

@alexdewar alexdewar requested a review from dalonsoa December 11, 2024 13:55
@alexdewar alexdewar changed the title Fix backwards compatibility measure scripts Allow for reading measure scripts generated with FINESSE v2.0.0 Dec 11, 2024
@alexdewar alexdewar requested a review from dc2917 December 11, 2024 13:56
Copy link

codecov bot commented Dec 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.88%. Comparing base (bd2ba61) to head (4016f56).
Report is 12 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #742      +/-   ##
==========================================
+ Coverage   86.87%   86.88%   +0.01%     
==========================================
  Files          69       69              
  Lines        3557     3560       +3     
==========================================
+ Hits         3090     3093       +3     
  Misses        467      467              

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

Copy link
Contributor

@dalonsoa dalonsoa 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 but why not making the schema assign automatically a default version value when validating? In other words, in here we use something like:

    schema = Schema(
        {
            Optional("version", default=1): int,
            "repeats": measurements_type,
            ...
         }
    )

@alexdewar
Copy link
Collaborator Author

@dalonsoa I was kind of in two minds about whether to change the actual schema or not. In the end I decided that if we ever make a v2 of the file format it'll probably be useful to be able to check the version up front to know which schema to use, so it's probably best to make sure it's always there.

@alexdewar alexdewar merged commit c81996e into main Dec 13, 2024
7 checks passed
@alexdewar alexdewar deleted the fix-backwards-compatibility-measure-scripts branch December 13, 2024 16:42
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.

Measure scripts generated with v2 of FINESSE not compatible anymore
3 participants