-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
81 lines (69 loc) · 2.08 KB
/
Copy pathMakefile
File metadata and controls
81 lines (69 loc) · 2.08 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
# Python Tutorial Makefile
# Local testing and development commands
.PHONY: help install lint format typecheck test build clean all
# Default target
help:
@echo "Available commands:"
@echo " install - Install dependencies with uv"
@echo " lint - Run linting checks"
@echo " format - Format code"
@echo " typecheck - Run type checking"
@echo " test - Test that Python code compiles"
@echo " test-build - Test build multiprocessing chapter"
@echo " build - Build all content locally"
@echo " clean - Clean build artifacts"
@echo " all - Run all checks and build"
# Install dependencies
install:
@echo "Installing dependencies..."
uv venv
uv sync
# Lint code
lint:
@echo "Running linting checks..."
uv run ruff check .
# Format code
format:
@echo "Formatting code..."
uv run ruff format .
# Type checking
typecheck:
@echo "Running type checks..."
uv run pyright
# Test Python code compilation
test:
@echo "Testing Python code compilation..."
@echo "Checking shared code examples..."
@for file in shared/code/*.py; do \
echo " Checking $$file..."; \
uv run python -m py_compile "$$file" || exit 1; \
done
@echo "Checking multiprocessing chapter syntax..."
@uv run python -c "exec(open('test_syntax.py').read())"
# Build content locally
build:
@echo "Building main landing page..."
uv run quarto render index.qmd
@echo "Building English content..."
uv run quarto render en/ --to html
@echo "Building Japanese content..."
uv run quarto render ja/ --to html
# Test build (extract and test Python code execution)
test-build:
@echo "Testing multiprocessing chapter Python code..."
@uv run python test_execution.py
@echo "Multiprocessing chapter code tested successfully!"
# Clean build artifacts
clean:
@echo "Cleaning build artifacts..."
rm -rf docs/
rm -rf _freeze/
rm -rf .quarto/
find . -name "*.pyc" -delete
find . -name "__pycache__" -delete
# Run all checks
all: install lint format typecheck test
@echo "All checks passed! Ready to build and deploy."
# Quick check (without install)
check: lint test
@echo "Quick checks passed!"