Add CARTA startup version validation - #168
Conversation
… subsetting and alpha preservation
…iterative probing
…om_imageview_id class method
…olor blending objects
…ology and usage patterns
…or coordinate system and number format methods
…lorBlending initialization
… for consistency with naming conventions
…ColorBlending and Layer method docstrings
…ces for consistency with documentation style
…of setActiveFrameById
|
A minor modification: it may make more sense for the script's target version to be compared to the wrapper's target frontend version rather than to the frontend's version directly. Or maybe do a three-way comparison, to cover all the bases (the failure setting could then be a bitmask of three possible values). |
|
I was thinking specifying a minimum frontend version in a script does not necessarily establish compatibility with the script. For example, a future feature may be implemented entirely in uv add --script example.py "carta-python==2.0.0"This adds the following metadata to the head of # /// script
# dependencies = [
# "carta-python==2.0.0",
# ]
# ///Anyone can then run the script with: uv run example.pyand |
|
I'm happy with that -- I think it's more important for us to check compatibility between the wrapper and the frontend, which is within our area of responsibility. The Once we have started publishing the package, we should add that workflow as a suggestion to the docs. |
…match_action to ERROR
|
I'll review these changes ASAP. I've realised that if we're going to be using the wrapper package version, we also need to decide how that's going to work (currently it's a bit random, and hasn't been updated in ages). I think that it should be tied to the CARTA release version, but there should also be a way of specifying updates to the wrapper only (that don't correspond to CARTA release updates). I've read the documentation about versioning here and here, and looked through some real packages on PyPi to see how versions are actually used in the wild, and this is my suggestion:
If there are no wrapper changes that depend on the development version of CARTA, this branch should match the versions of the main branch (the main branch should be kept in sync, so that they are identical), only switching to the scheme below when / if the branches need to diverge:
Whenever a new CARTA release is published, the dev branch version should become If we can read the version from the package, we wouldn't need to have a separate constant for the minimum compatible CARTA version, since we could parse it from the package version. I think that if we strip What about major version boundaries? I previously suggested that we could bump the wrapper's minimum version with every major CARTA release to try to safeguard against removal of deprecated frontend functions, but this approach has drawbacks, and I don't think that there's any method that would be more reliable. I suggest that we don't bump the version unless we actually need to and rely on deprecation warnings to alert the user that they need to update the wrapper. We could perhaps remove functions in the second major release after deprecation, to ensure that the deprecation period is at least one full major version. |
|
I've thought about it some more and I have an alternative suggestion for a maximum version heuristic: decouple the versions used for the minimum and maximum check. For the minimum check, use the package version (as suggested above). For the maximum version, store a TARGET_CARTA_VERSION constant which is only a major version. Bump this constant with every CARTA release, but if there are no development changes, do not bump the CARTA portion of the package version. So for example:
The checks should fail if the CARTA version is lower than the minimum version (as per package version) or if the CARTA major version is higher than TARGET_CARTA_VERSION. So these should be the results for recent wrappers:
In contrast to this strategy, if we were to estimate the maximum major version from the minimum version, and we bumped the package version to 7.0.0.0 with the release, the 7.0.0.0 version of the wrapper would report that CARTA 6.5.0 was too old (despite versions all the way down to 6.3.0 being fine), and the user would have to switch to warnings to use it. Given that the user is likely to have control over their wrapper version (they can install it in a userspace environment), but may be reliant on a site provider to upgrade CARTA, this is a common use case. Since we would in general like to encourage users to keep their wrapper up to date and maintain their scripts to match, and not to provide any barriers to upgrading, I would prefer to slightly inconvenience users of old wrappers than to slightly inconvenience users of the latest wrapper. 😆 So my vote is for separating the checks. There may be slight modifications to the procedure outlined above if the situation is different:
(I'm not dead-set on the last two -- we could always treat deprecation fixes as dependent on the release that deprecated them, and most of the time they will probably be caused by refactoring and will probably depend on new changes. But if they don't, we don't have to.) Does this make sense? (Once we have agreed on all of these versioning procedures, we can document them in a developer section of the docs.) |
|
Sorry for taking longer to think through the versioning strategy. I discussed this with KC and KS regarding how frontend should be handled from a broader perspective. After considering the different compatibility boundaries between CARTA and The reason is that CARTA and
Therefore, these two versions should evolve independently. For example:
Compatibility handlingInstead of encoding CARTA versions into the For example:
This allows
The table should describe the recommended compatibility relationship, rather than requiring every CARTA release to have a corresponding Backward compatibilityBackward compatibility handling should be maintained within |
|
I'm happy with this general idea. Should we update this PR to start implementing it now, or should we move it back into draft until we're ready to start branching and packaging the wrapper? We could start the table with the CARTA and wrapper versions as they are now -- but we should start by bumping the wrapper version in dev, since it currently depends on the dev frontend. |
Description
Closes #166 and #28.
Dependency #161 has been merged.
Adds startup validation for CARTA scripting sessions by fetching
frontendVersionand checking it against the minimum CARTA version supported by the installedcarta-pythonwrapper.Script authors can also provide a single minimum version through
minimum_carta_version, for example"6.1.0". Prerelease suffixes such as"6.1.0-dev"are supported. Version operators and ranges are intentionally not accepted.What is implemented
CartaUnsupportedVersionfor unsupported CARTA frontend versions.Session.interactSession.start_and_interactSession.createSession.start_and_create6.0.0(will be bumped to6.1.0before release).minimum_carta_version.VersionMismatchAction.WARNandVersionMismatchAction.ERROR.versions, invalid frontend versions, and validation failures.
validation fails.
Checklist