Skip to content

Commit 46c8215

Browse files
committed
added support for justfile
1 parent db0aa59 commit 46c8215

2 files changed

Lines changed: 196 additions & 5 deletions

File tree

CONTRIBUTING.md

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,34 @@ uv run ruff format .
7171

7272
Both approaches work equally well! Use whichever you prefer. The `uv run` approach is convenient if you don't want to activate the environment, as it automatically uses the correct virtual environment for each command.
7373

74+
**Option 3: Use `just`** (recommended)
75+
76+
We provide a [`justfile`](https://github.com/casey/just) as a command runner for common development tasks. This is the easiest way to run commands — no need to remember long `uv run` invocations.
77+
78+
```bash
79+
# Install just (if not already installed)
80+
brew install just # macOS
81+
# or: cargo install just
82+
83+
# List all available commands
84+
just
85+
86+
# Examples
87+
just test # Run default test suite
88+
just test-core # Run core tests
89+
just check # Run all quality checks (format, lint, typecheck)
90+
just docs # Serve documentation locally
91+
```
92+
93+
All `just` recipes accept extra arguments. For example:
94+
95+
```bash
96+
just test-core -x --tb=short # Stop on first failure, short tracebacks
97+
just test-benchmark -k "macs" # Run only MACS benchmark tests
98+
```
99+
100+
> **Note**: All commands also work with `uv run` directly — `just` is a convenience wrapper.
101+
74102
### 2. Code Style and Linting
75103

76104
We use `ruff` to enforce a consistent code style. Before committing, please run the formatter and linter.
@@ -83,15 +111,14 @@ ruff format .
83111
ruff check . --fix
84112
```
85113

86-
If you haven't activated your virtual environment, you can use `uv run ruff format .` and `uv run ruff check . --fix` instead.
87-
88114
For convenience, you can enable **pre-commit hooks** to automatically format and lint code on every commit:
89115

90116
```bash
91117
uv run pre-commit install
92118
```
93119

94120
This is optional—CI will catch any issues regardless. But if enabled, the hooks will:
121+
95122
- **Format** code with `ruff format` (using project settings from `pyproject.toml`)
96123
- **Lint and auto-fix** issues with `ruff check --fix`
97124

@@ -212,9 +239,9 @@ The pipeline automatically performs the following tasks:
212239

213240
- **Linting and Formatting**: Verifies that your code adheres to our style guide using `ruff`.
214241
- **Testing** (tiered):
215-
- *Fast tests* (every PR, Python 3.10–3.14): core, benchmark, and all default-suite tests. No API keys needed.
216-
- *Slow tests* (every PR, Python 3.12): data download and integrity validation.
217-
- *Credentialed tests* (every PR, Python 3.12): live API tests. Requires maintainer approval to run — secrets are only exposed after approval.
242+
- _Fast tests_ (every PR, Python 3.10–3.14): core, benchmark, and all default-suite tests. No API keys needed.
243+
- _Slow tests_ (every PR, Python 3.12): data download and integrity validation.
244+
- _Credentialed tests_ (every PR, Python 3.12): live API tests. Requires maintainer approval to run — secrets are only exposed after approval.
218245
- **Type Checking**: Validates type annotations using `ty`.
219246
- **Documentation**: Ensures documentation builds without errors using `mkdocs`.
220247

justfile

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
set quiet
2+
set dotenv-load := false
3+
4+
# ─── Default ──────────────────────────────────────────────────────────────────
5+
6+
# List all available recipes
7+
default:
8+
@just --list --unsorted
9+
10+
# ─── Environment Setup ────────────────────────────────────────────────────────
11+
12+
# Install all dependencies (dev tools + optional deps)
13+
install:
14+
uv sync --all-extras --all-groups
15+
16+
# Install core dependencies only (no optional deps)
17+
install-core:
18+
uv sync --group dev
19+
20+
# Install documentation dependencies only
21+
install-docs:
22+
uv sync --group docs
23+
24+
# ─── Code Quality ─────────────────────────────────────────────────────────────
25+
26+
# Format code with ruff
27+
format:
28+
uv run ruff format .
29+
30+
# Check formatting without modifying files
31+
format-check:
32+
uv run ruff format --check .
33+
34+
# Lint code with ruff
35+
lint:
36+
uv run ruff check .
37+
38+
# Lint and auto-fix issues
39+
lint-fix:
40+
uv run ruff check . --fix
41+
42+
# Run ty type checker on maseval and tests
43+
typecheck:
44+
uv run ty check maseval tests
45+
46+
# Run all quality checks (format, lint, typecheck)
47+
check: format-check lint typecheck
48+
49+
# Format and fix lint issues
50+
fix: format lint-fix
51+
52+
# ─── Testing — Core ──────────────────────────────────────────────────────────
53+
54+
# Run default test suite (excludes slow, credentialed, smoke)
55+
test *ARGS:
56+
uv run pytest -v {{ ARGS }}
57+
58+
# Run core tests only (no optional deps needed)
59+
test-core *ARGS:
60+
uv run pytest -m core -v {{ ARGS }}
61+
62+
# Run interface tests (requires optional deps)
63+
test-interface *ARGS:
64+
uv run pytest -m interface -v {{ ARGS }}
65+
66+
# Run cross-implementation contract tests
67+
test-contract *ARGS:
68+
uv run pytest -m contract -v {{ ARGS }}
69+
70+
# Run fast benchmark tests (excludes slow/live)
71+
test-benchmark *ARGS:
72+
uv run pytest -m "benchmark and not (slow or live)" -v {{ ARGS }}
73+
74+
# ─── Testing — Frameworks ────────────────────────────────────────────────────
75+
76+
# Run smolagents framework tests
77+
test-smolagents *ARGS:
78+
uv run pytest -m smolagents -v {{ ARGS }}
79+
80+
# Run langgraph framework tests
81+
test-langgraph *ARGS:
82+
uv run pytest -m langgraph -v {{ ARGS }}
83+
84+
# Run llamaindex framework tests
85+
test-llamaindex *ARGS:
86+
uv run pytest -m llamaindex -v {{ ARGS }}
87+
88+
# Run gaia2 benchmark tests
89+
test-gaia2 *ARGS:
90+
uv run pytest -m gaia2 -v {{ ARGS }}
91+
92+
# Run camel framework tests
93+
test-camel *ARGS:
94+
uv run pytest -m camel -v {{ ARGS }}
95+
96+
# ─── Testing — Special Modes ─────────────────────────────────────────────────
97+
98+
# Run slow tests — data downloads + integrity checks (needs network)
99+
test-slow *ARGS:
100+
uv run pytest -m "(slow or live) and not credentialed" -v {{ ARGS }}
101+
102+
# Run credentialed tests — live API calls (needs API keys)
103+
test-credentialed *ARGS:
104+
uv run pytest -m "credentialed and not smoke" -v {{ ARGS }}
105+
106+
# Run smoke tests — full end-to-end pipeline validation
107+
test-smoke *ARGS:
108+
uv run pytest -m smoke -v {{ ARGS }}
109+
110+
# Run fully offline tests (no network access)
111+
test-offline *ARGS:
112+
uv run pytest -m "not live" -v {{ ARGS }}
113+
114+
# Run all tests except smoke
115+
test-all *ARGS:
116+
uv run pytest -m "not smoke" -v {{ ARGS }}
117+
118+
# ─── All-in-One ───────────────────────────────────────────────────────────────
119+
120+
# Fix, check, and run default tests
121+
all: fix typecheck test
122+
123+
# Fix, check, and run all tests including slow (excludes credentialed/smoke)
124+
all-slow: fix typecheck test-all test-slow
125+
126+
# ─── Coverage ─────────────────────────────────────────────────────────────────
127+
128+
# Run default tests with coverage and print report
129+
coverage *ARGS:
130+
uv run coverage run -m pytest -v {{ ARGS }}
131+
uv run coverage report
132+
133+
# Generate HTML coverage report and open it
134+
coverage-html: coverage
135+
uv run coverage html
136+
open htmlcov/index.html
137+
138+
# ─── Documentation ────────────────────────────────────────────────────────────
139+
140+
# Serve documentation locally (http://127.0.0.1:8000)
141+
docs:
142+
uv run mkdocs serve
143+
144+
# Build documentation with strict checking
145+
docs-build:
146+
uv run mkdocs build --strict
147+
148+
# ─── Utilities ────────────────────────────────────────────────────────────────
149+
150+
# Find tests without any CI-mapped marker (potential orphans)
151+
orphans:
152+
#!/usr/bin/env bash
153+
uv run pytest --collect-only -q -m "not (core or benchmark or interface or slow or live or credentialed or smoke)" && \
154+
echo "⚠ Orphaned tests found above — add appropriate markers" || \
155+
echo "No orphaned tests found"
156+
157+
# Remove build artifacts and caches
158+
clean:
159+
rm -rf .coverage .coverage.* htmlcov/ site/ dist/ .pytest_cache/
160+
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
161+
162+
# Install pre-commit hooks
163+
pre-commit:
164+
uv run pre-commit install

0 commit comments

Comments
 (0)