-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
120 lines (93 loc) · 3.14 KB
/
Copy pathjustfile
File metadata and controls
120 lines (93 loc) · 3.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# BMECatExplorer Justfile
# Default recipe - show available commands
default:
@just --list
# Start PostgreSQL and OpenSearch containers
up:
docker compose up -d
# Stop containers
down:
docker compose down
# Stop containers and remove volumes
down-clean:
docker compose down -v
# Show container status
status:
docker compose ps
# Show container logs
logs *ARGS:
docker compose logs {{ ARGS }}
# Convert BMECat XML to JSONL
convert INPUT OUTPUT:
uv run python main.py {{ INPUT }} {{ OUTPUT }}
# Convert with header extraction
convert-with-header INPUT OUTPUT HEADER:
uv run python main.py {{ INPUT }} {{ OUTPUT }} {{ HEADER }}
# Import JSONL to PostgreSQL (supports extra args like --catalog-id)
import FILE *ARGS:
uv run python -m src.db.import_jsonl {{ FILE }} {{ ARGS }}
# Index products from PostgreSQL to OpenSearch
index:
uv run python -m src.search.indexer
# Index products with embeddings (requires OPENAI_API_KEY)
index-embed:
uv run python -m src.search.indexer --embeddings
# Index products to a specific catalog namespace
index-catalog CATALOG_ID SOURCE_FILE:
uv run python -m src.search.indexer --catalog-id {{ CATALOG_ID }} --source-file {{ SOURCE_FILE }} --no-recreate
# Index catalog with embeddings
index-catalog-embed CATALOG_ID SOURCE_FILE:
uv run python -m src.search.indexer --catalog-id {{ CATALOG_ID }} --source-file {{ SOURCE_FILE }} --no-recreate --embeddings
# Start API server
serve:
uv run uvicorn src.api.app:app --reload --port 9019
# Start API server (production mode)
serve-prod:
uv run uvicorn src.api.app:app --host 0.0.0.0 --port 9019
# Start frontend server
serve-frontend:
uv run uvicorn frontend.app:app --reload --port 9018
# Start frontend server (production mode)
serve-frontend-prod:
uv run uvicorn frontend.app:app --host 0.0.0.0 --port 9018
# Run unit tests
test-unit:
uv run pytest tests/unit -v
# Run integration tests (requires running containers)
test-integration:
uv run pytest tests/integration -v -m integration
# Run smoke tests (requires running API server)
test-smoke:
uv run pytest tests/smoke -v -m smoke
# Lint with Ruff
lint:
uv run ruff check .
# Format with Black
format:
uv run black .
# Run all tests
test:
uv run pytest -v
# Full setup: start containers, import data, index, and serve
setup FILE:
just up
@echo "Waiting for services to be ready..."
sleep 5
just import {{ FILE }}
just index
@echo "Setup complete. Run 'just serve' to start the API."
# Quick pipeline: convert XML, import, index
pipeline INPUT:
just convert {{ INPUT }} data/products.jsonl
just import data/products.jsonl --replace-catalog
just index
# Full pipeline with embeddings
pipeline-embed INPUT:
just convert {{ INPUT }} data/products.jsonl
just import data/products.jsonl --replace-catalog
just index-embed
# Pipeline for multi-catalog setup (appends to existing index)
pipeline-catalog INPUT CATALOG_ID:
just convert {{ INPUT }} data/products.jsonl
just import data/products.jsonl --catalog-id {{ CATALOG_ID }} --source-file {{ INPUT }} --replace-catalog
just index-catalog {{ CATALOG_ID }} {{ INPUT }}