Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Installation Guide

Set up your local development environment. Time: ~5 minutes.


Prerequisites

ToolVersionInstall
Docker Desktop4.25+docker.com
uvlatestcurl -LsSf https://astral.sh/uv/install.sh | sh

⚠️ Python 3.12 required — uv will install it automatically.


Security

🔐 Credential Handling

  • Secrets via environment variables or secret manager only
  • Never commit .env files
  • No PII in model artifacts or logs

Step 1: Clone Repository

git clone https://github.com/hungryhub-team/hh-lion.git
cd hh-lion

Step 2: Configure Environment

cp .env.example .env

Step 3: Start Infrastructure

docker compose up -d

Verify:

docker compose ps

Expected: core containers running (redis, clickhouse, kafka, schema-registry, minio, mlflow, tei, opensearch)

ContainerPortURLPurpose
hh-lion-redis16379-Caching
hh-lion-clickhouse19000 / 18123localhost:18123/pingFeature/event store
hh-lion-kafka19092-Events
hh-lion-schema-registry18081localhost:18081Schemas
hh-lion-minio19100 / 19001localhost:19001Artifacts
hh-lion-mlflow15000localhost:15000Tracking
hh-lion-tei18080localhost:18080/healthText embeddings
hh-lion-opensearch19200localhost:19200Search metadata

Step 4: Create Python Environment

# uv auto-detects Python 3.12 from .python-version
uv sync --all-extras

That’s it! No conda activate needed.


Step 5: Verify

uv run python -c "import recsys; print('✅ Ready!')"

CLI Commands

All operations use uv run prefix:

CommandDescription
uv run python -m scripts.compute_member_features --mode full --publish-onlinePublish member features to Feast v2
uv run python -m scripts.compute_item_features --mode full --publish-onlinePublish item features to Feast v2
uv run python -m scripts.compute_cohort_features --mode full --publish-onlinePublish cohort features to Feast v2
TRAINING_DATA_SOURCE=clickhouse uv run python -m scripts.train --config homepage_personalizationTrain model from ClickHouse bookings
uv run python -m scripts.evaluate --run_id <ID> --holdout_path <temporal_holdout.{csv,parquet}>Evaluate against a temporal holdout file
uv run python -m scripts.register_model --run_id <ID> --name homepage_two_tower --stage EngineeringRegister homepage model and transition it to Engineering
uv run python -m scripts.backfill_annBackfill ANN index
uv run pytest tests/Run tests

Environment Variables

VariableDescriptionDefault
ENVIRONMENTRuntime mode (development, engineering, production)development
MLFLOW_MODEL_NAMERegistered model name to load(unset)
MLFLOW_MODEL_ALIASRegistered model alias to load(unset)
FORCE_MOCK_MODELForce mock serving mode (blocked in engineering/production)false
MLFLOW_TRACKING_URIMLflow URLhttp://localhost:15000
MLFLOW_S3_ENDPOINT_URLMinIO URLhttp://localhost:19100
AWS_ACCESS_KEY_IDMinIO keyminioadmin
AWS_SECRET_ACCESS_KEYMinIO secretminioadmin
REDIS_HOSTRedis hostnamelocalhost
REDIS_PORTRedis port16379
REDIS_DBRedis database index0
REDIS_TLSEnable TLS for Redis connectionsfalse
CACHE_HMAC_SECRETSecret for refresh ownership HMAC validation(empty)
CORS_ALLOWED_ORIGINSAllowed CORS origins*
ANONYMOUS_ID_COOKIE_HTTPONLYSet anonymous_id cookie with HttpOnly (set false only if client-side JS must read it)true
GROWTHBOOK_API_HOSTGrowthBook feature endpoint host(empty)
GROWTHBOOK_CLIENT_KEYGrowthBook SDK key(empty)
GROWTHBOOK_DEFAULT_HOMEPAGE_MODELFallback homepage model variant when GrowthBook is unavailable or the flag is missing (control or member_two_tower)control
TEI_API_URLTEI endpoint for embedding generationhttp://localhost:18080
TEI_TIMEOUT_SECONDSEmbedding request timeout5.0
NAMESPACEOptional Kafka topic namespace prefix(empty)
KAFKA_BOOTSTRAP_SERVERSKafka bootstrap servers for impression events(unset)
KAFKA_SECURITY_PROTOCOLKafka broker security protocolplaintext
KAFKA_SCHEMA_REGISTRY_URLSchema Registry URL for Avro clientshttp://localhost:18081
KAFKA_IMPRESSION_TOPICBase Kafka topic for impression events; prefixed by NAMESPACE when sethh.lion.recsys.impressions

GPU / TorchRec (Optional)

For GPU development with TorchRec, Conda is still required:

conda env create -f envs/dev-x86-gpu.yml
conda activate hh-lion-dev-x86-gpu

See envs/README.md for details.


Troubleshooting

IssueSolution
ModuleNotFoundError: recsysuv sync --all-extras
Port in uselsof -i :<port>
TorchRec not found (Mac)Expected — TorchRec requires x86 + CUDA

Next

Quickstart: Train your first modelFull Localhost Runbook (No Mock)Operations Runbook IndexRelease Readiness Checklist