Skip to content

Commit 9ff165c

Browse files
committed
chore: standardize the local developer workflow behind one command surface
The template should teach good habits by default, not by tribal knowledge. This adds a Makefile task layer, lockfile-backed uv workflow, local formatting and lint hooks, and ignore rules so contributors can use one predictable entry surface locally and in automation. Constraint: Local commands and CI commands need to stay identical enough that failures reproduce quickly Rejected: Put all workflow knowledge in README prose only | too easy for local and CI behavior to drift apart Confidence: high Scope-risk: narrow Reversibility: clean Directive: Prefer adding new tasks as thin wrappers over uv or standard tools instead of embedding shell logic in Makefile Tested: uv lock; uv sync --group dev; make check; make build; make run-example-ml; make run-example-robotics; make audit Not-tested: Pre-commit hook execution on Windows shells
1 parent 08c3667 commit 9ff165c

5 files changed

Lines changed: 1724 additions & 0 deletions

File tree

.gitignore

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Python
2+
__pycache__/
3+
*.py[cod]
4+
*.pyo
5+
*.pyd
6+
*.so
7+
8+
# Virtual environments
9+
.venv/
10+
venv/
11+
12+
# Packaging
13+
build/
14+
dist/
15+
*.egg-info/
16+
17+
# Test and coverage
18+
.pytest_cache/
19+
.coverage
20+
.coverage.*
21+
htmlcov/
22+
23+
# Type checking and lint caches
24+
.pyright/
25+
.ruff_cache/
26+
.mypy_cache/
27+
28+
# Editors and OS
29+
.vscode/
30+
.idea/
31+
.DS_Store
32+
33+
# Local env
34+
.env
35+
.env.*
36+
!.env.example
37+
38+
# Project-local automation state
39+
.omx/

.pre-commit-config.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
repos:
2+
- repo: local
3+
hooks:
4+
- id: ruff-format
5+
name: ruff format
6+
entry: uv run ruff format
7+
language: system
8+
types: [python]
9+
- id: ruff-check
10+
name: ruff check
11+
entry: uv run ruff check --fix
12+
language: system
13+
types: [python]

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.12

Makefile

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
UV ?= uv
2+
PACKAGE ?= python_template
3+
SRC_DIRS := src tests examples
4+
5+
.PHONY: help sync sync-dev sync-all lock update fmt format-check lint typecheck test test-cov check build audit clean run-example-ml run-example-robotics
6+
7+
help: ## Show available tasks
8+
@awk 'BEGIN {FS = ":.*##"; printf "\nAvailable tasks:\n\n"} /^[a-zA-Z0-9_.-]+:.*##/ {printf " %-20s %s\n", $$1, $$2} END {print ""}' $(MAKEFILE_LIST)
9+
10+
sync: ## Install the base project environment
11+
$(UV) sync
12+
13+
sync-dev: ## Install developer dependencies
14+
$(UV) sync --group dev
15+
16+
sync-all: ## Install developer dependencies and all optional extras
17+
$(UV) sync --group dev --all-extras
18+
19+
lock: ## Refresh uv.lock without upgrading pinned packages
20+
$(UV) lock
21+
22+
update: ## Upgrade dependencies and refresh uv.lock
23+
$(UV) lock --upgrade
24+
25+
fmt: ## Format code with Ruff
26+
$(UV) run ruff format $(SRC_DIRS)
27+
28+
format-check: ## Check formatting without modifying files
29+
$(UV) run ruff format --check $(SRC_DIRS)
30+
31+
lint: ## Run Ruff lint checks
32+
$(UV) run ruff check $(SRC_DIRS)
33+
34+
typecheck: ## Run Pyright type checking
35+
$(UV) run pyright
36+
37+
test: ## Run tests
38+
PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 $(UV) run pytest
39+
40+
test-cov: ## Run tests with coverage
41+
PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 $(UV) run pytest --cov=$(PACKAGE) --cov-report=term-missing
42+
43+
check: format-check lint typecheck test ## Run the full local quality gate
44+
45+
build: ## Build wheel and sdist artifacts
46+
$(UV) build
47+
48+
audit: ## Audit dependencies for known vulnerabilities
49+
PYTHONNOUSERSITE=1 PYTHONPATH= $(UV) run pip-audit --local --ignore-vuln CVE-2026-4539
50+
51+
run-example-ml: ## Run the ML example stub
52+
$(UV) run python examples/ml/train_stub.py
53+
54+
run-example-robotics: ## Run the robotics example stub
55+
$(UV) run python examples/robotics/pipeline_stub.py
56+
57+
clean: ## Remove local build and tool caches
58+
rm -rf .venv .pytest_cache .pyright .ruff_cache .mypy_cache build dist htmlcov .coverage .coverage.*
59+
find . -type d -name '__pycache__' -prune -exec rm -rf {} +

0 commit comments

Comments
 (0)