Enforcement of ARMI app version with metdata:versions #1066
Replies: 1 comment 4 replies
-
Yeah, the "metadata" version was put there for legal/process reasons. We don't really use or enforce it heavily. It is interesting that the warning isn't even printed out though.
On occasion, people ask me about the versions of their
Perhaps your from myapp import __version__
VERSION_SETTING = "myPluginVersion"
class MyPlugin(ArmiPlugin):
@staticmethod
@plugins.HOOKIMPL
def defineSettings():
return [
Setting(
VERSION_SETTING,
default="uncontrolled",
label="stuff",
description="things",
)
]
@staticmethod
@plugins.HOOKIMPL
def defineSettingsValidators(inspector):
return [
settingsValidation.Query(
lambda: inspector.cs[VERSION_SETTING] != __version__,
"Oh noes! The MyPlugin version doesn't match!",
"Do you want to force the version to match?",
lambda: inspector._assignCS(VERSION_SETTING, True),
)
] The above I'm just spit-balling here @drewj-usnctech . Thoughts? |
Beta Was this translation helpful? Give feedback.
-
Some reading of #1064 // #1064 has me curious about the
metadata:versions
setting. Digging through the settings implementation, the version from the file is attached asinputVersion
armi/armi/settings/settingsIO.py
Line 222 in 9d6a405
and
self.liveVersion
is set toarmi.meta.__version__
But, if they differ, there isn't an explicit error. Any mismatch is noted if there is an invalid setting if an
InvalidSettingsStopProcess
is raisedarmi/armi/utils/customExceptions.py
Lines 103 to 122 in 9d6a405
which is created in
SettingsReader._checkInvalidSettings
armi/armi/settings/settingsIO.py
Lines 226 to 244 in 9d6a405
So long as I don't have any invalid settings in my different ARMI version, then I would never be alerted that my version differs from the one specified in the settings file.
The second question that follows is making this application specific. Is this something that could be picked up by the app version? Our ARMI application has different version numbers from ARMI, so if we wanted to leverage this feature, we would want to tie the version from the input not to the version of the armi library, but to our ARMI application
Beta Was this translation helpful? Give feedback.
All reactions