summaryrefslogtreecommitdiff
path: root/justfile
blob: c1e1b1f6e3fa00e32d51802f5aa183bb9d815598 (plain)
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
# PicoStream - Justfile

set windows-shell := ["C:\\Program Files\\Git\\bin\\sh.exe", "-c"]

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

# Run the picostream GUI application
gui:
    PYTHONPATH=. uv run picostream/main.py

# Run with MOCK device (no hardware needed)
mock:
    PYTHONPATH=. uv run python -c "import os; os.environ['MOCK_PICO'] = '1'; from picostream.main import main; main()"

# Format all code
fmt:
    uv run ruff format picostream/

# Check code formatting without fixing
fmt-check:
    uv run ruff format --check picostream/

# Lint code
lint:
    uv run ruff check picostream/

# Fix linting issues
lint-fix:
    uv run ruff check --fix picostream/.

# Type check code
type-check:
    uv run pyright picostream/

# Run all checks (format check, lint, type-check)
check: fmt-check lint type-check
    @echo "✓ All checks passed"

# Run all checks and fix what can be fixed
fix: lint-fix fmt
    @echo "✓ Code fixed"

# Run all dev tools (tests run even if type-check fails)
devtools: fix fmt-check lint test type-check

# Run all tests
test:
    PYTHONPATH=. uv run pytest picostream -v

# Run tests with coverage
test-cov:
    PYTHONPATH=. uv run pytest picostream --cov=picostream --cov-report=term-missing -v

# Run tests and generate HTML coverage report
test-cov-html:
    PYTHONPATH=. uv run pytest picostream --cov=picostream --cov-report=html -v
    @echo "Coverage report: file://$(pwd)/htmlcov/index.html"

# Profile the PicoStream GUI (outputs to profile.stats)
profile:
    PYTHONPATH=. uv run python -m cProfile -o profile.stats picostream/main.py

# View profile results in browser (snakeviz)
profile-view:
    uv run snakeviz profile.stats

# Print top 20 functions by cumulative time (quick CLI view)
profile-text:
    uv run python -c "import pstats; p = pstats.Stats('profile.stats'); p.sort_stats('cumulative').print_stats(20)"

# Build the picostream GUI executable with PyInstaller
build:
    uv pip install pyinstaller pyinstaller-hooks-contrib
    uv run pyinstaller \
        --name PicoStream \
        --onefile \
        --windowed \
        --collect-all vispy \
        --icon assets/icons/app.ico \
        picostream/main.py

# Sync dependencies (install/update)
sync:
    uv sync

# Update all dependencies
update:
    uv lock --upgrade

# Clean build artifacts and caches
clean:
    rm -rf build/ dist/ picostream/*.spec __pycache__ .pytest_cache .ruff_cache
    find picostream -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
    find picostream -type f -name "*.pyc" -delete 2>/dev/null || true