|
| 1 | +.. _optional_features: |
| 2 | + |
| 3 | +Optional Features and updates |
| 4 | +============================= |
| 5 | + |
| 6 | +LabThings allows some features to be turned on and off globally, using the `.FEATURE_FLAGS` object. |
| 7 | +This was introduced as a way to smooth the upgrade process for downstream projects, meaning that when a new version of LabThings is released, they need not adopt all the new features at once. |
| 8 | + |
| 9 | +Typically, your application will set the feature flags once, just after importing LabThings. For example, to validate properties when they are written to in Python, we would do: |
| 10 | + |
| 11 | +.. code-block: python |
| 12 | +
|
| 13 | + import labthings_fastapi as lt |
| 14 | +
|
| 15 | +
|
| 16 | + lt.FEATURE_FLAGS.validate_properties_on_set = True |
| 17 | +
|
| 18 | +When new features are intended to become non-optional, the usual procedure will be: |
| 19 | + |
| 20 | +* Introduce the feature in a release, but disable it by default. It may be activated by setting a flag to `True`\ . |
| 21 | +* At some point (either the release that introduces it, or a future release) a `DeprecationWarning` will be raised by relevant code if the feature has not been enabled. |
| 22 | +* A subsequent release will enable the feature by default, but it may still be disabled by setting the flag to `False`\ . This will raise a `DeprecationWarning`\ . |
| 23 | +* Another release will remove the feature flag and the feature will be permanently enabled. |
| 24 | + |
| 25 | +Introducing a feature that's disabled by default, and adding `DeprecationWarning`\ s, are not "breaking changes" as they require no change to downstream code. |
| 26 | +Enabling a feature by default, or removing the ability to disable a feature, would constitute a "breaking change". |
| 27 | +While our major version is zero, the intention is that patch releases (e.g. ```0.1.0``` to ``0.1.1``) should not make breaking changes, but minor releases (e.g. ``0.1.0`` to ``0.2.0``) may do so. |
| 28 | +After `v1.0.0` LabThings should follow the Semantic Versioning convention and make breaking changes only when the major version changes. |
0 commit comments