pip install feast
feast init my_features
cd my_featuresfrom feast import Entity, FeatureView, FileSource, Field
from feast.types import Float32, Int64
from datetime import timedelta
customer = Entity(name="customer_id", join_keys=["customer_id"])
customer_source = FileSource(
path="data/customer_features.parquet",
timestamp_field="event_timestamp",
)
customer_fv = FeatureView(
name="customer_features",
entities=[customer],
ttl=timedelta(days=1),
schema=[
Field(name="lifetime_value", dtype=Float32),
Field(name="total_orders", dtype=Int64),
],
source=customer_source,
)# Initial materialization
feast materialize 2024-01-01T00:00:00 2024-12-31T00:00:00
# Incremental (from last run to now)
feast materialize-incremental $(date -u +%Y-%m-%dT%H:%M:%S)from feast import FeatureStore
store = FeatureStore(repo_path=".")
# Online (for serving)
features = store.get_online_features(
features=["customer_features:lifetime_value"],
entity_rows=[{"customer_id": 123}],
)
# Offline (for training)
training_df = store.get_historical_features(
entity_df=entity_df,
features=["customer_features:lifetime_value"],
)pip install -r requirements.txt
python -c "
from src.feature_registry import FeatureRegistry, FeatureType
reg = FeatureRegistry('./my_registry')
reg.register('user_age', FeatureType.INT, 'user_id', description='User age in years')
print(reg.list_features())
"┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Data Sources │ ──> │Materialization│ ──> │ Feature Store │
│ (tables, etc)│ │ Jobs │ │ │
└──────────────┘ └──────────────┘ ├──────────────┤
│ Offline Store │ <── Training
│ (Parquet/BQ) │
├──────────────┤
│ Online Store │ <── Serving
│ (Redis/dict) │
└──────────────┘
This toolkit includes a reference implementation that runs with zero
infrastructure. When you're ready for production, swap in Feast:
1. Install Feast: pip install feast
2. Copy configs/feast_feature_store.yaml to your repo
3. Adapt configs/feast_feature_repo.py with your feature definitions
4. Run feast apply to register features
5. Run feast materialize-incremental to compute features