I think feature flags being set by import in any file is confusing and will cause problems in the future. It means that adding a new Thing to a configuration can change the behaviour of other base things. For example if someone turned a feature flag on in a custom extension in the microscope it changes the base microscope behaviour. I didn't see that this was the mechanism before it was merged as part of an unrelated MR, but I think it is likely to cause problems.
I would be in favour of changing this before any release
I would suggest rather than using
lt.FEATURE_FLAGS.validate_properties_on_set = True
to turn on a feature flag instead. I would only turn them on and off in the configuration, however any file that requires a flag to be on or off could do:
lt.feature_flags.require = {"validate_properties_on_set", True}
This way, it is very clear what to do if two things require something incompatible. It will also allow a Thing to do:
lt.feature_flags.require = {"feature_from_future_version", False}
And as it is a string LabThings could warn that this feature doesn't exits rather than error. Allowing code to run on old versions as long as the feature flag was required not to exists.
I think feature flags being set by import in any file is confusing and will cause problems in the future. It means that adding a new
Thingto a configuration can change the behaviour of other base things. For example if someone turned a feature flag on in a custom extension in the microscope it changes the base microscope behaviour. I didn't see that this was the mechanism before it was merged as part of an unrelated MR, but I think it is likely to cause problems.I would be in favour of changing this before any release
I would suggest rather than using
to turn on a feature flag instead. I would only turn them on and off in the configuration, however any file that requires a flag to be on or off could do:
This way, it is very clear what to do if two things require something incompatible. It will also allow a Thing to do:
And as it is a string LabThings could warn that this feature doesn't exits rather than error. Allowing code to run on old versions as long as the feature flag was required not to exists.