Validate frontend API and enum contracts - #169
Conversation
confluence
left a comment
There was a problem hiding this comment.
I'm going to wait until the other PRs have been resolved before doing a final review, but I have an alternative suggestion for specifying the links to protobuf and frontend enums:
- Create mix-in classes called
FrontendEnumandProtobufEnum. - For each of these, implement a registration mechanism for subclasses (similar to the region and view mechanism), which:
- Checks the subclass for an optional
snapshot_nameclass attribute (maybe this should be called something likeexternal_nameorreference_name-- and it should probably be in all caps for style consistency) - Updates a class dict that maps snapshot names to enum subclasses (if no custom
snapshot_nameis provided, the name of the class is used by default)
- Checks the subclass for an optional
- Make each class that is linked to a frontend or protobuf enum inherit one of these mixins.
Now by default enums won't be linked to anything, and you can access the mappings of the mixins to get the lists of frontend- and protobuf-linked enums (instead of having to tag every enum and parse them all manually), and you don't have to provide external names explicitly unless the class name is different.
|
I removed the unrelated code changes from |
|
I found that it would be better to make it work without launching CARTA. I will make a script in frontend to generate a list of enum and use it for validation. |
…thonEnum mixins for categorizing and validating enums by their source
…I and enum manifest validation
437faa6 to
1a7f2d7
Compare
Description
Closes #157, #162, and #177.
Blocked by companion frontend PR: CARTAvis/carta-frontend#2922 (merged)
This PR aligns carta-python with the CARTA frontend's renamed boolean and validation properties and adds machine-checkable API and enum contracts for development-time compatibility checks.
What is implemented:
devCI job that checks generated carta-python manifests against carta-frontend.Checklist
For linked issues (if any):
For the pull request:
no tests neededno documentation update neededFor dependencies and compatibility:
no companion PRs needed/ no dependency changespyproject.tomlanduv.lockupdatedCARTA compatibility table updated when the minimum CARTA series changes/ no compatibilityor
devstarts a newcarta-pythonmajor/minor serieschange
For pull requests targeting
main:VERSION.txtfinalized for the releaseminimum supported CARTA series