-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
164 lines (133 loc) Β· 4.97 KB
/
Copy pathjustfile
File metadata and controls
164 lines (133 loc) Β· 4.97 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
uv := require("uv")
project_dir := justfile_directory()
src_dir := project_dir / "dqlitepy"
tests_dir := project_dir / "tests"
export PY_COLORS := "1"
export PYTHONBREAKPOINT := "pdb.set_trace"
export PYTHONPATH := project_dir / "dqlitepy"
uv_run := "uv run --frozen"
[private]
default:
@just help
# Regenerate uv.lock
[group("dev")]
lock:
uv lock
# Create a development environment
[group("dev")]
env: lock
uv sync --extra dev
# Upgrade uv.lock with the latest dependencies
[group("dev")]
upgrade:
uv lock --upgrade
# Apply coding style standards to code
[group("lint")]
fmt: lock
{{uv_run}} ruff format {{src_dir}} {{tests_dir}}
{{uv_run}} ruff check --fix {{src_dir}} {{tests_dir}}
# Check code against coding style standards
[group("lint")]
lint: lock
{{uv_run}} codespell {{src_dir}}
{{uv_run}} ruff check {{src_dir}}
# Run static type checker on code
[group("lint")]
typecheck: lock
{{uv_run}} pyright
# Build vendored raft and dqlite libraries (for local development)
[group("dev")]
build-vendor:
bash scripts/build_vendor_libs.sh
# Build the native Go library locally (requires build-vendor to be run first)
[group("dev")]
build-lib-local: lock build-vendor
{{uv_run}} python scripts/build_go_lib.py -v
# Build the native Go library using Docker (proper/recommended way)
[group("dev")]
build-lib:
#!/usr/bin/env bash
set -e
echo "==> Building native library using Docker"
docker build --target go-build --tag dqlitepy-lib-builder .
docker create --name dqlitepy-lib-extract dqlitepy-lib-builder
docker cp dqlitepy-lib-extract:/build/dqlitepy/_lib/. ./dqlitepy/_lib/
docker rm dqlitepy-lib-extract
echo "==> Library extracted to dqlitepy/_lib/"
ls -lh dqlitepy/_lib/linux-amd64/
# Run unit tests with coverage (59% threshold)
# Note: Coverage is limited by untested modules (sqlalchemy=0%, client=27%)
# and upstream segfault preventing full node lifecycle testing
[group("test")]
unit: lock build-lib
{{uv_run}} pytest {{tests_dir}} --cov={{src_dir}} --cov-report=term-missing --cov-fail-under=59
# Install Docusaurus dependencies
[group("docusaurus")]
docs-install:
@echo "π¦ Installing Docusaurus dependencies..."
cd docusaurus && yarn install
# Start Docusaurus development server
[group("docusaurus")]
docs-dev: docs-install
@echo "π Starting Docusaurus development server..."
cd docusaurus && yarn start
# Start Docusaurus development server on specific port
[group("docusaurus")]
docs-dev-port port="3000": docs-install
@echo "π Starting Docusaurus development server on port {{port}}..."
cd docusaurus && yarn start --port {{port}}
# Build Docusaurus for production
[group("docusaurus")]
docs-build: docs-install
@echo "ποΈ Generating API documentation from source..."
{{uv_run}} python3 ./docusaurus/scripts/generate-api-docs.py
@echo "ποΈ Building Docusaurus for production..."
cd docusaurus && yarn build
# Generate API documentation from SDK source code
[group("docusaurus")]
docs-generate-api:
@echo "π Generating API documentation from source..."
{{uv_run}} python3 ./docusaurus/scripts/generate-api-docs.py
# Serve built Docusaurus site locally
[group("docusaurus")]
docs-serve: docs-build
@echo "π Serving built Docusaurus site..."
cd docusaurus && yarn serve
# Clean Docusaurus build artifacts
[group("docusaurus")]
docs-clean:
@echo "π§Ή Cleaning Docusaurus build artifacts..."
cd docusaurus && rm -rf build .docusaurus
# Show available documentation commands
[group("docusaurus")]
docs-help:
@echo "π Docusaurus Commands:"
@echo " docs-install - Install dependencies"
@echo " docs-dev - Start development server"
@echo " docs-dev-port - Start dev server on specific port"
@echo " docs-build - Build for production (includes API docs generation)"
@echo " docs-generate-api - Generate API docs from SDK source"
@echo " docs-serve - Serve built site"
@echo " docs-clean - Clean build artifacts"
# Build dqlitepy wheel using Docker
build-wheel:
./scripts/build_wheel_docker.sh
# Run FastAPI example cluster with Docker Compose
run-fast-api-example:
docker compose -f examples/fast_api_example/docker-compose.yml up
# Run FastAPI example cluster in detached mode
run-fast-api-example-d:
docker compose -f examples/fast_api_example/docker-compose.yml up -d
# Stop FastAPI example cluster
stop-fast-api-example:
docker compose -f examples/fast_api_example/docker-compose.yml down
# Stop FastAPI example and clean volumes
clean-fast-api-example:
docker compose -f examples/fast_api_example/docker-compose.yml down -v
# View FastAPI example logs
logs-fast-api-example:
docker compose -f examples/fast_api_example/docker-compose.yml logs -f
# Rebuild and restart FastAPI example
rebuild-fast-api-example:
docker compose -f examples/fast_api_example/docker-compose.yml down
docker compose -f examples/fast_api_example/docker-compose.yml up --build