-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathjustfile
71 lines (58 loc) · 2.01 KB
/
justfile
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
#!/usr/bin/env just --justfile
# List available commands
default:
@just --list
# Create virtualenv if it doesn't exist or is missing dependencies
venv:
#!/usr/bin/env bash
set -e -o pipefail
if [ ! -d ".venv" ] || (! . .venv/bin/activate && pip freeze | grep -q "pytest"); then
echo "Creating new virtualenv..."
python -m venv .venv
. .venv/bin/activate
pip install --upgrade pip -r requirements-dev.txt -e .
else
echo "Using existing virtualenv..."
fi
# Install development dependencies
install: venv
. .venv/bin/activate && pip install -r requirements-dev.txt
. .venv/bin/activate && pip install -e .
# Run black code formatter
fmt: venv
. .venv/bin/activate && black tfparse tests
# Check code formatting with black
fmt-check: venv
. .venv/bin/activate && black --check tfparse tests
# Run flake8 linter
lint: venv
. .venv/bin/activate && flake8 --verbose tfparse tests
# Run all linting checks
check: fmt-check lint
# Run tests with pytest
test *args: venv
. .venv/bin/activate && pytest {{args}}
# Run tests with coverage
test-cov: venv
. .venv/bin/activate && pytest --cov=tfparse tests
# Run all checks (format, lint, test)
all: check test
# Clean up Python cache files and virtualenv
clean:
find . -type d -name "__pycache__" -exec rm -r {} +
find . -type f -name "*.pyc" -delete
find . -type f -name "*.pyo" -delete
find . -type f -name "*.pyd" -delete
find . -type f -name ".coverage" -delete
find . -type d -name "*.egg-info" -exec rm -r {} +
find . -type d -name "*.egg" -exec rm -r {} +
find . -type d -name ".pytest_cache" -exec rm -r {} +
find . -type d -name ".coverage" -exec rm -r {} +
find . -type d -name "htmlcov" -exec rm -r {} +
rm -rf .venv
# Install Delve if not present
install-dlv:
go install github.com/go-delve/delve/cmd/dlv@latest
# Debug Go code with Delve
debug cmd args: install-dlv
cd gotfparse && dlv debug --check-go-version=false ./cmd/{{cmd}}/main.go -- ../{{args}}