-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
109 lines (90 loc) · 2.97 KB
/
justfile
File metadata and controls
109 lines (90 loc) · 2.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
# docutools - Development Task Runner
# Modern replacement for the make script using just
# Default recipe to display help
default:
@just --list
# Initialize development environment using brew. Tested on OSX
init:
@command -v brew >/dev/null || (echo "❌ Error: Homebrew is required but not installed." && echo "Install it from: https://brew.sh" && exit 1)
@echo "Installing system dependencies..."
brew install tmux graphviz imagemagick
@echo "Setting up uv and installing dependencies..."
uv sync
@echo "Development environment ready!"
# Install/sync dependencies
install:
uv sync
# Run all tests
test *ARGS:
uv run pytest {{ARGS}} tests -c config/pytest.ini
# Run tests with coverage
test-cov:
uv run coverage run --rcfile=config/coverage.pytest.ini -m pytest tests -c config/pytest.ini
uv run coverage combine
uv run coverage report --precision=2
# Format code with ruff
format:
uv run ruff format src tests
uv run ruff check --fix src tests
# Run type checking
typecheck:
uv run mypy src
# Lint code
lint:
uv run ruff check src tests
# Run all quality checks (format, lint, typecheck)
check: format lint typecheck
# Build documentation
docs:
rm -f docs/autodocs
uv run coverage run --rcfile=config/coverage.lp.ini $(uv run which mkdocs) build
# Serve documentation locally
docs-serve PORT="2222":
@echo "Serving docs on http://127.0.0.1:{{PORT}}"
@pkill -f "mkdocs serve.*{{PORT}}" || true
lp_eval=on_page_change uv run mkdocs serve -a "127.0.0.1:{{PORT}}"
# Check documentation links
docs-checklinks:
uv run linkchecker --help | cat >/dev/null || (echo "Install linkchecker: pip install git+https://github.com/linkchecker/linkchecker.git" && exit 1)
uv run linkchecker site --ignore-url '(.*).json'
# Clean build artifacts and caches
clean:
rm -f .coverage*
rm -rf .mypy_cache .pytest_cache build dist pip-wheel-metadata site public __pycache__
find . -name "*.pyc" -delete
find . -name "__pycache__" -type d -exec rm -rf {} + 2>/dev/null || true
just clean-lp
# Clean LP (Literal Programming) caches
clean-lp:
@echo "Cleaning LP caches..."
find . -name "*.lp.py" -delete
# Build the package
build:
uv build
# Run tests and lp doc tests:
doctest:
just test
just docs
# Calcs a version, adds it to pyproject, git tags
new-version VERSION="":
#!/usr/bin/env bash
set -xeuo pipefail
VERSION="{{VERSION}}"
if [ -z "$VERSION" ]; then VERSION=$(date "+%Y.%m.%d"); fi
echo "Releasing version $VERSION"
sed -i '' "s/^version = .*/version = \"$VERSION\"/" pyproject.toml
git commit -am "chore: Prepare release $VERSION" || true
git tag -d "$VERSION" 2>/dev/null || true
git tag "$VERSION"
# Pushes the tag, publishes to pypi
publish:
git pull
git push --tags || true
just clean
just build
uv publish --token "$(pass pypitoken)"
# Development shortcuts
alias t := test
alias d := docs
alias ds := docs-serve
alias clc := clean-lp