aboutsummaryrefslogtreecommitdiffstats
path: root/justfile
blob: 9586090887311138d5ecc2719d24f0139521dbe9 (plain) (blame)
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
# Justfile for selectui development tasks

# Unset VIRTUAL_ENV to avoid conflicts with uv
export VIRTUAL_ENV := ""

# Default recipe - show available commands
default:
    @just --list

# Install dependencies (including dev dependencies)
install:
    uv sync --all-groups

# Run all checks (ruff + mypy)
check: check-ruff check-mypy

# Run ruff linter
check-ruff:
    @echo "Running ruff..."
    uv run ruff check src/ tests/ examples/

# Run mypy type checker
check-mypy:
    @echo "Running mypy..."
    uv run mypy src/ tests/ examples/

# Run all tests with pytest
test:
    @echo "Running pytest..."
    uv run pytest tests/ -v --tb=short

# Run tests with coverage report
test-cov:
    @echo "Running pytest with coverage..."
    uv run pytest tests/ -v --cov=src/selectui --cov-report=term-missing --cov-report=html

# Fix all auto-fixable issues
fix: fix-ruff

# Run ruff with auto-fix
fix-ruff:
    @echo "Running ruff --fix..."
    uv run ruff check src/ tests/ examples/ --fix

# Format code with ruff
fmt:
    @echo "Formatting code with ruff..."
    uv run ruff format src/ tests/ examples/

# Run all checks and tests
ci: check test
    @echo "✅ All checks and tests passed!"

# Clean build artifacts
clean:
    @echo "Cleaning build artifacts..."
    rm -rf build/ dist/ *.egg-info .pytest_cache .mypy_cache .ruff_cache htmlcov/ .coverage
    find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true

# Run the demo (interactive)
demo:
    @echo "Running interactive demo..."
    @echo "This will launch the selectui with sample data"
    @echo "Press Ctrl+C to exit"
    @echo ""
    cat examples/example.json | jq -c '.[]' | uv run selectui

# Run a specific example
example NUM:
    @echo "Running example {{NUM}}..."
    uv run python examples/pydantic_example.py {{NUM}}

# Watch tests (requires entr)
watch-test:
    @echo "Watching for changes..."
    find src tests -name "*.py" | entr -c just test

# Show project info
info:
    @echo "Project: selectui"
    @echo "Python: $(uv run python --version)"
    @echo "Dependencies:"
    @uv pip list

# Lint everything (alias for check)
lint: check

# Run pre-commit checks (check + test)
pre-commit: check test
    @echo "✅ Pre-commit checks passed!"