-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjustfile
More file actions
293 lines (254 loc) Β· 10.9 KB
/
Copy pathjustfile
File metadata and controls
293 lines (254 loc) Β· 10.9 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
# Laxy Development Commands
# Run `just` to see available commands
# Default recipe shows help
default:
@just --list
# Start servers (optionally specify service name)
up service='':
#!/usr/bin/env bash
export LAXY_ENV=${LAXY_ENV:-local-dev}
COMPOSE_FILE="docker-compose.${LAXY_ENV}.yml"
if [ -z "{{service}}" ]; then
echo "π Starting Laxy development environment..."
docker compose -f docker-compose.yml -f "${COMPOSE_FILE}" up -d
echo "β
Services starting... Check logs with 'just logs'"
echo " Frontend: http://localhost:8002"
echo " Backend: http://localhost:8001"
else
echo "π Starting service: {{service}}..."
docker compose -f docker-compose.yml -f "${COMPOSE_FILE}" up -d {{service}}
fi
# Stop servers (optionally specify service name)
down service='':
#!/usr/bin/env bash
export LAXY_ENV=${LAXY_ENV:-local-dev}
COMPOSE_FILE="docker-compose.${LAXY_ENV}.yml"
if [ -z "{{service}}" ]; then
echo "π Stopping Laxy development environment..."
docker compose -f docker-compose.yml -f "${COMPOSE_FILE}" down
else
echo "π Stopping service: {{service}}..."
docker compose -f docker-compose.yml -f "${COMPOSE_FILE}" stop {{service}}
fi
# Show container logs. Optionally pass a service name.
logs service='':
#!/usr/bin/env bash
export LAXY_ENV=${LAXY_ENV:-local-dev}
COMPOSE_FILE="docker-compose.${LAXY_ENV}.yml"
if [ -z "{{service}}" ]; then
docker compose -f docker-compose.yml -f "${COMPOSE_FILE}" logs --tail 50 -f
else
docker compose -f docker-compose.yml -f "${COMPOSE_FILE}" logs --tail 50 -f {{service}}
fi
# Build Docker images
build:
#!/usr/bin/env bash
echo "π¨ Building Docker images..."
export LAXY_ENV=${LAXY_ENV:-local-dev}
COMPOSE_FILE="docker-compose.${LAXY_ENV}.yml"
docker compose -f docker-compose.yml -f "${COMPOSE_FILE}" build
# Run unit tests inside docker-compose.test.yml (pytest against laxy_backend)
test-unit:
#!/usr/bin/env bash
# Non-default buildx builders (e.g. docker-container drivers) cannot see locally tagged
# images; FROM laxy:dev would try docker.io/library/laxy:dev. Force the default builder.
if ! docker image inspect laxy:dev >/dev/null 2>&1; then
echo "π¨ laxy:dev not found locally; building base image (docker/laxy-test/Dockerfile depends on it)..."
docker compose -f docker-compose.yml -f docker-compose.local-dev.yml build --builder default django
fi
echo "π§ͺ Running unit tests with docker-compose.test.yml (pytest, unit-tests service)..."
docker compose -f docker-compose.test.yml build --builder default unit-tests
docker compose -f docker-compose.test.yml up --exit-code-from unit-tests --abort-on-container-exit --no-build
status=$?
echo "π§Ή Cleaning up test containers..."
docker compose -f docker-compose.test.yml down -v
exit $status
# Run integration tests via pytest against a running local-dev environment (django container)
test-integration:
#!/usr/bin/env bash
echo "π Running integration tests against local-dev environment (django container)..."
export LAXY_ENV=${LAXY_ENV:-local-dev}
COMPOSE_FILE="docker-compose.${LAXY_ENV}.yml"
docker compose -f docker-compose.yml -f "${COMPOSE_FILE}" exec django pytest -vvv --showlocals --tb=auto --integration tests/integration
# Run individual integration test suites against a running local-dev environment (django container)
test-jwt:
#!/usr/bin/env bash
echo "π Testing JWT authentication against local-dev environment (django container)..."
export LAXY_ENV=${LAXY_ENV:-local-dev}
COMPOSE_FILE="docker-compose.${LAXY_ENV}.yml"
docker compose -f docker-compose.yml -f "${COMPOSE_FILE}" exec django pytest -vvv --showlocals --tb=auto --integration tests/integration/test_jwt_auth.py
test-files:
#!/usr/bin/env bash
echo "π Testing file operations against local-dev environment (django container)..."
export LAXY_ENV=${LAXY_ENV:-local-dev}
COMPOSE_FILE="docker-compose.${LAXY_ENV}.yml"
docker compose -f docker-compose.yml -f "${COMPOSE_FILE}" exec django pytest -vvv --showlocals --tb=auto --integration tests/integration/test_file_operations.py
test-external:
#!/usr/bin/env bash
echo "π Testing external integrations against local-dev environment (django container)..."
export LAXY_ENV=${LAXY_ENV:-local-dev}
COMPOSE_FILE="docker-compose.${LAXY_ENV}.yml"
docker compose -f docker-compose.yml -f "${COMPOSE_FILE}" exec django pytest -vvv --showlocals --tb=auto --integration tests/integration/test_external_integrations.py
# Run all tests (unit + integration)
test-all: test-unit test-integration
# Default test target: unit tests only
test: test-unit
# --- Synthetic annotation corpus -------------------------------------------
# Fast tiers (detect + filter + seqid). No Django, no containers. ~1s.
test-annotation-corpus:
@echo "𧬠Running annotation corpus (detect + filter + seqid)..."
pytest tests/data/annotation_corpus/ -m "corpus and not e2e"
# Tier 4 read-generation sanity (generates + counts reads; no nextflow).
test-annotation-corpus-reads:
@echo "𧬠Annotation corpus: generating reads + sanity checks..."
pytest tests/data/annotation_corpus/test_annotation_e2e.py::test_e2e_reads_sanity
# Full nf-core/rnaseq e2e (needs nextflow + fake-cluster stack up).
test-annotation-corpus-e2e:
@echo "𧬠Annotation corpus: full nf-core/rnaseq e2e (slow)..."
pytest tests/data/annotation_corpus/ -m e2e
# Regenerate the shared synthetic genome from its fixed seed.
annotation-genome:
@echo "𧬠Regenerating shared/genome.fa (fixed seed)..."
python3 tests/data/annotation_corpus/shared/generate_genome.py -o tests/data/annotation_corpus/shared/genome.fa
gzip -kf tests/data/annotation_corpus/shared/genome.fa
# Re-seed cases/*/annotation.* from the doc catalogue (one-off bootstrap).
annotation-fixtures:
@echo "𧬠(Re)writing case annotation fixtures..."
python3 tests/data/annotation_corpus/shared/make_annotation_fixtures.py
@just annotation-manifests
# Snapshot current detector/filter behaviour into cases/*/manifest.json.
annotation-manifests:
@echo "𧬠Regenerating manifests from actual behaviour..."
python3 tests/data/annotation_corpus/shared/make_manifests.py
# Run database migrations
migrate:
#!/usr/bin/env bash
echo "ποΈ Running database migrations..."
export LAXY_ENV=${LAXY_ENV:-local-dev}
COMPOSE_FILE="docker-compose.${LAXY_ENV}.yml"
docker compose -f docker-compose.yml -f "${COMPOSE_FILE}" exec django python manage.py migrate
# Create Django superuser
superuser:
#!/usr/bin/env bash
echo "π€ Creating Django superuser..."
export LAXY_ENV=${LAXY_ENV:-local-dev}
COMPOSE_FILE="docker-compose.${LAXY_ENV}.yml"
docker compose -f docker-compose.yml -f "${COMPOSE_FILE}" exec django python manage.py createsuperuser
# π Code Quality Commands
# Setup local virtual environment with production dependencies
setup-venv:
#!/usr/bin/env bash
echo "π¦ Setting up local virtual environment (production dependencies)..."
if [ ! -d ".venv" ]; then
uv venv
fi
source .venv/bin/activate && uv pip install -r requirements.txt
echo "β
Virtual environment ready!"
# Setup local virtual environment with development dependencies
setup-venv-dev:
#!/usr/bin/env bash
echo "π¦ Setting up local virtual environment (development dependencies)..."
if [ ! -d ".venv" ]; then
uv venv
fi
source .venv/bin/activate && uv pip install -r requirements-dev.txt
echo "β
Virtual environment ready!"
# Run code linting
lint: setup-venv-dev
@echo "π Running linters..."
@.venv/bin/ruff check --select=E9,F63,F7,F82 laxy_backend/
@.venv/bin/ruff check --select=E9,F63,F7,F82 laxy_pipeline_apps/
# Format code with ruff
format: setup-venv-dev
@echo "π¨ Formatting code..."
@.venv/bin/ruff format laxy_backend/
@.venv/bin/ruff format laxy_pipeline_apps/
# Run type checking with mypy
typecheck: setup-venv-dev
@echo "π¬ Running type checks..."
@.venv/bin/mypy laxy_backend/ --ignore-missing-imports
# Check system requirements
check:
#!/usr/bin/env bash
echo "π Checking system requirements..."
# Check Docker
if command -v docker >/dev/null 2>&1; then
echo "β
Docker: $(docker --version)"
else
echo "β Docker not found"
exit 1
fi
# Check Docker Compose
if docker compose version >/dev/null 2>&1; then
echo "β
Docker Compose: $(docker compose version)"
else
echo "β Docker Compose not found"
exit 1
fi
# Check Python
if command -v python3 >/dev/null 2>&1; then
echo "β
Python: $(python3 --version)"
else
echo "β Python 3 not found"
exit 1
fi
# Check uv
if command -v uv >/dev/null 2>&1; then
echo "β
uv: $(uv --version)"
else
echo "β uv not found (install from https://docs.astral.sh/uv/getting-started/installation/)"
exit 1
fi
echo "π All requirements satisfied!"
# Show service status
status:
#!/usr/bin/env bash
echo "π Service Status:"
export LAXY_ENV=${LAXY_ENV:-local-dev}
COMPOSE_FILE="docker-compose.${LAXY_ENV}.yml"
docker compose -f docker-compose.yml -f "${COMPOSE_FILE}" ps
# Open useful URLs
open:
#!/usr/bin/env bash
echo "π Opening Laxy URLs..."
if command -v open >/dev/null 2>&1; then
# macOS
open http://localhost:8002 # Frontend
open http://localhost:8001/admin # Admin
elif command -v xdg-open >/dev/null 2>&1; then
# Linux
xdg-open http://localhost:8002
xdg-open http://localhost:8001/admin
else
echo " Frontend: http://localhost:8002"
echo " Admin: http://localhost:8001/admin"
echo " API: http://localhost:8001/api/v1/"
echo " Swagger: http://localhost:8001/api/v1/schema/swagger-ui/"
fi
# Execute shell in Django container
django-shell:
#!/usr/bin/env bash
export LAXY_ENV=${LAXY_ENV:-local-dev}
COMPOSE_FILE="docker-compose.${LAXY_ENV}.yml"
docker compose -f docker-compose.yml -f "${COMPOSE_FILE}" exec django python manage.py shell
# Execute bash in Django container
bash:
#!/usr/bin/env bash
export LAXY_ENV=${LAXY_ENV:-local-dev}
COMPOSE_FILE="docker-compose.${LAXY_ENV}.yml"
docker compose -f docker-compose.yml -f "${COMPOSE_FILE}" exec django bash
# Full setup for new developers
setup:
@echo "π Setting up Laxy development environment..."
just check
just setup-venv-dev
just build
just up
@echo "β³ Waiting for services to start..."
@sleep 10
just status
@echo "π Setup complete! Run 'just open' to access the application"
just open
# Complete test suite for CI/CD (unit + integration)
ci: check test-all
restart: down up