Chalk can enforce requirements on your feature values.
You can validate the values and length of many primitive types
through the keyword arguments
To prevent ‘invalid’ features from being written
to the offline or online store, set
In this case an error will be thrown when an invalid
feature is observed.
validations keyword argument can be used when there are
multiple validations, only some of which are strict.
from chalk import Validation from chalk.features import feature, features @features class Office: size_sqft: int = feature(min=0, max=100_000_000) street: str = feature(validations=[ Validation(min_length=1, max_length=256, strict=True), Validation(min_length=20, max_length=100) ])
For some features, it is important to specify metadata
Chalk allows you to enforce metadata requirement easily.
In addition, you can specify for each feature the severity
at which to raise a missing metadata issue.
validation > feature > metadata
section specifies settings for metadata validation.
In the following example, users will be blocked from
deploying features (
chalk apply) with
owner. They are allowed to deploy
features with missing
project: Predict Q2 Spending validation: feature: metadata: - name: owner missing: error - name: description missing: warning - name: tags missing: info environments: default: runtimes: 'python310' requirements: requirements.txt