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

Remove fits metaschema #378

Merged
merged 5 commits into from
Jan 23, 2025
Merged

Conversation

braingram
Copy link
Collaborator

@braingram braingram commented Jan 22, 2025

The fits metaschema provides no validation for the current schemas (see #261). It also references an old version (1.0.0) of the asdf metaschema.

This PR updates the datamodels schemas to use the new asdf metaschema 1.1.0 instead of the fits metaschema and removes the now unused fits metaschema.

This impact of this change is minimal and restricted to pytest/CI runs for this package. The metaschema is only used when the schema is checked with check_schema. check_schema validates a schema against the stated metaschema and is not run in the pipeline (as expected) and is not run directly in this repository. It is only run as part of the pytest asdf plugin which runs in the CI for this package.

Regtests running at: https://github.com/spacetelescope/RegressionTests/actions/runs/12917676424

Tasks

  • update or add relevant tests
  • update relevant docstrings and / or docs/ page
  • Does this PR change any API used downstream? (if not, label with no-changelog-entry-needed)
    • write news fragment(s) in changes/: echo "changed something" > changes/<PR#>.<changetype>.rst (see below for change types)
    • run jwst regression tests with this branch installed ("git+https://github.com/<fork>/stdatamodels@<branch>")
news fragment change types...
  • changes/<PR#>.feature.rst: new feature
  • changes/<PR#>.bugfix.rst: fixes an issue
  • changes/<PR#>.doc.rst: documentation change
  • changes/<PR#>.removal.rst: deprecation or removal of public API
  • changes/<PR#>.misc.rst: infrastructure or miscellaneous change

Copy link

codecov bot commented Jan 22, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.17%. Comparing base (788f7bd) to head (5b3d8b3).
Report is 10 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main     #378       +/-   ##
===========================================
+ Coverage   67.59%   78.17%   +10.57%     
===========================================
  Files         115      115               
  Lines        5932     5146      -786     
===========================================
+ Hits         4010     4023       +13     
+ Misses       1922     1123      -799     

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

@braingram braingram marked this pull request as ready for review January 23, 2025 13:27
@braingram braingram requested a review from a team as a code owner January 23, 2025 13:27
@braingram braingram requested review from tapastro and emolter January 23, 2025 13:28
@braingram
Copy link
Collaborator Author

@melanieclarke I can't request you as a reviewer so I'll add a ping here. I'll try to sort out why I can't request you and fix that.

@braingram
Copy link
Collaborator Author

braingram commented Jan 23, 2025

The random CI failure for py312-xdist that popped up in the latest run is due to conflicting crds reference file downloads, crds not locking and not verifying files: spacetelescope/crds#930
Maybe for this package (since the CRDS usage is minimal outside of the jwst downstream tests) we could turn on the cache file lock without too much of a performance hit for the tests. However the downstream jwst tests would continue to randomly fail (like the CI failure here) unless we also enable the lock there (which would make the tests essentially run in 1 process). Either way the failure is unrelated to this PR.

EDIT: I reran that job and it passed. I'm leaving this here as we may still want to consider locking crds for the unit tests as described above.

Copy link
Contributor

@melanieclarke melanieclarke left a comment

Choose a reason for hiding this comment

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

This looks fine to me. Can you point me to the asdf 1.1.0 schema, for my education?

@braingram
Copy link
Collaborator Author

This looks fine to me. Can you point me to the asdf 1.1.0 schema, for my education?

Thanks!

Here's 1.1.0: https://github.com/asdf-format/asdf-standard/blob/main/resources/schemas/stsci.edu/asdf/asdf-schema-1.1.0.yaml

@tapastro
Copy link
Collaborator

Does the replacement of the unused fits metaschema with the asdf metaschema retain some functionality? Is it needed?

@braingram
Copy link
Collaborator Author

Does the replacement of the unused fits metaschema with the asdf metaschema retain some functionality? Is it needed?

To recap the huddle discussion.

  • The metaschemas check the schemas and only do so during pytest/CI runs of stdatamodels. The changes here have no impact on datamodel validation.
  • The current fits metaschema provides no additional functionality over asdf-1.0.0 (due to the lack of recursion of the property validators for fits_keyword and fits_hdu) so dropping it (and replacing it with the asdf metaschema) doesn't lose any functionality.
  • asdf-1.1.0 vs asdf-1.0.0 added support for defining float16 as a valid datatype (with respect to ASDF). There are no plans to use float16 and we'd probably need to not map these to FITS (as it doesn't support float16). We could stick with asdf 1.0.0 but since we're making the change now that 1.1.0 is available my vote is for the newer one.
  • This PR doesn't add unit tests to validate fits_hdu/fits_keyword schema contents but this could be added in a follow up PR that could also address any potential issues uncovered (there's nothing validating the fits_hdu/fits_keyword schema keywords currently so it's possible there are differences between the structure in the current fits metaschema and the datamodel schema contents). Given that as far as we know all the datamodels work any bugs would be issues with the metaschema defined structure and addressed in the added unit tests.

Copy link
Collaborator

@tapastro tapastro left a comment

Choose a reason for hiding this comment

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

🧹 🗑️

@braingram braingram merged commit b49f5f4 into spacetelescope:main Jan 23, 2025
22 checks passed
@braingram braingram deleted the meta_and_potatoes branch January 23, 2025 17:16
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.

3 participants