-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjustfile
More file actions
142 lines (108 loc) · 4.97 KB
/
Copy pathjustfile
File metadata and controls
142 lines (108 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
# ──────────────────────────────────────────────────────────────────────
# myapp — project control plane
# Run `just --list` for a quick overview of available commands.
# ──────────────────────────────────────────────────────────────────────
set dotenv-load := false
# Default recipe shown when you run `just` with no arguments
default:
@just --list
# ── Onboarding ────────────────────────────────────────────────────────
# Bootstrap the project: install deps, create data dirs, run doctor
init:
uv sync --all-extras
mkdir -p data/json data/db
@just doctor
# Sync dependencies from lockfile
sync:
uv sync --all-extras
# Verify environment health
doctor:
uv run project doctor
# ── Development ───────────────────────────────────────────────────────
# Format code
fmt:
uv run ruff format src/
# Lint code
lint:
uv run ruff check src/
# Lint and auto-fix
lint-fix:
uv run ruff check --fix src/
# Type-check code
typecheck:
uv run mypy src/myapp/
# Run tests
test *ARGS:
uv run pytest {{ARGS}}
# Run tests with coverage
cov:
uv run pytest --cov=myapp --cov-report=term-missing
# Run all quality checks (fmt check + lint + typecheck + tests)
check:
uv run ruff format --check src/
uv run ruff check src/
uv run mypy src/myapp/
uv run pytest
# ── Run ───────────────────────────────────────────────────────────────
# Run the default service
run:
uv run project run
# Run a CLI command (pass any args)
cli *ARGS:
uv run project {{ARGS}}
# Run Streamlit UI
ui:
uv run streamlit run ui/streamlit_app.py
# ── Scaffolding ─────────────────────────────────────────────────────
# Scaffold a new service with all required files
scaffold NAME:
uv run python scripts/scaffold_service.py {{NAME}}
# Rename the project (replaces all occurrences of OLD with NEW)
rename OLD NEW:
@echo "Renaming '{{OLD}}' → '{{NEW}}' across the codebase..."
find src/ docs/ ui/ scripts/ -type f -name '*.py' -o -name '*.md' -o -name '*.toml' -o -name '*.yml' | xargs sed -i 's/{{OLD}}/{{NEW}}/g'
sed -i 's/{{OLD}}/{{NEW}}/g' pyproject.toml justfile README.md CONTRIBUTING.md
mv src/{{OLD}} src/{{NEW}} 2>/dev/null || true
@echo "Done. Run 'just init' to re-sync."
# ── Build & Release ──────────────────────────────────────────────────
# Build wheel + sdist
build:
uv build
# Publish to PyPI (configure credentials first)
publish:
uv publish
# Build Docker image
docker-build:
docker build -t myapp:latest .
# Run Docker container
docker-run:
docker run --rm -it myapp:latest
# ── Clean ───────────────────────────────────────────────────────────
# Remove build artifacts and caches
clean:
rm -rf dist/ build/ *.egg-info/
rm -rf .pytest_cache/ .mypy_cache/ .ruff_cache/ htmlcov/
find src/ -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
@echo "Cleaned."
# ── Docs ──────────────────────────────────────────────────────────────
# Open the quickstart guide
docs:
@echo "Documentation is in docs/ — start with docs/quickstart.md"
@echo ""
@echo " docs/quickstart.md Get running in 3 commands"
@echo " docs/architecture.md Services, boundaries, data flow"
@echo " docs/cli-reference.md All commands and options"
@echo " docs/persistence.md JSON vs SQLite, no-sync explained"
@echo " docs/extending.md Add services, commands, schemas, UI pages"
# ── Service patterns ─────────────────────────────────────────────────
# To add commands for a new service, copy one of the patterns below
# and replace "example" with your service name.
# Run example service
svc-example-run:
uv run project svc example list
# Test example service
svc-example-test:
uv run pytest src/myapp/services/example/tests/
# Show example service schema
svc-example-schema:
uv run project svc example schema