Skip to content

Commit d03f912

Browse files
committed
fix: CI lint driver issue and add Verso code roles
- Remove batteries lintDriver (not a dependency) - Disable lint in lean-action CI workflow - Add {lit} roles to Palette.lean hex colors - Add scripts/install.sh for easy setup - Update Justfile: replace lint with setup command
1 parent b86c797 commit d03f912

6 files changed

Lines changed: 57 additions & 25 deletions

File tree

.github/workflows/lean_action_ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v4
1414
- uses: leanprover/lean-action@v1
15+
with:
16+
lint: false # We don't use batteries linter

Justfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ build:
1212
clean:
1313
lake clean
1414

15-
# Run linter
16-
lint:
17-
lake lint
15+
# Setup/install dependencies
16+
setup:
17+
./scripts/install.sh
1818

1919
# Generate documentation images (SVG)
2020
doc-images:

LeanPlot/Components.lean

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -311,64 +311,64 @@ of dots. The bar color is supplied via {lit}`fillColor`.
311311
/-! ## Simple Plotting (Zero-Configuration Plots) -/
312312

313313
/-- 🎯 Plot a function with automatic everything. Just works!
314-
314+
315315
Examples:
316316
- {lit}`plotSimple (fun t => t^2)` - Simple quadratic plot
317317
- {lit}`plotSimple (fun x => x + 1)` - Linear function
318318
- {lit}`plotSimple (fun i => i * 2)` - Linear scaling
319319
320320
You never have to think about axis labels again!
321321
-/
322-
def plotSimple {β} [ToFloat β] (f : Float → β) (steps : Nat := 200)
322+
def plotSimple {β} [ToFloat β] (f : Float → β) (steps : Nat := 200)
323323
(domain : Option (Float × Float) := none) (w h : Nat := 400) : Html :=
324324
-- Sample the function
325325
let data := sample f steps domain
326-
326+
327327
-- Generate axis labels (this would use metaprogramming in full implementation)
328328
-- For now, provide sensible defaults that work with the common patterns
329-
let xLabel := "x"
329+
let xLabel := "x"
330330
let yLabel := "f(x)"
331331
let seriesStrokes := #[("y", "#2563eb")] -- Nice blue color
332-
332+
333333
mkLineChartWithLabels data seriesStrokes (some xLabel) (some yLabel) w h
334334

335335
/-- Plot multiple functions with automatic labeling.
336336
Just pass your functions and get a beautiful multi-line plot!
337-
338-
Examples:
337+
338+
Examples:
339339
- {lit}`plotManySimple #[("sin", fun t => Float.sin t), ("cos", fun t => Float.cos t)]`
340340
- {lit}`plotManySimple #[("linear", fun x => x), ("quadratic", fun x => x^2)]`
341341
342342
Everything is automatic - colors, labels, legend!
343343
-/
344-
def plotManySimple {β} [ToFloat β] (fns : Array (String × (Float → β)))
345-
(steps : Nat := 200) (domain : Float × Float := (0.0, 1.0))
344+
def plotManySimple {β} [ToFloat β] (fns : Array (String × (Float → β)))
345+
(steps : Nat := 200) (domain : Float × Float := (0.0, 1.0))
346346
(w h : Nat := 400) : Html :=
347347
-- Sample all functions
348348
let data := sampleMany fns steps domain.1 domain.2
349-
350-
-- Generate axis labels
349+
350+
-- Generate axis labels
351351
let xLabel := "x" -- Could be enhanced with metaprogramming
352352
let yLabel := "y" -- Could be enhanced with metaprogramming
353-
353+
354354
-- Auto-generate colors for each series
355355
let colors := #["#2563eb", "#dc2626", "#16a34a", "#ca8a04", "#7c3aed", "#db2777"]
356-
let seriesStrokes := fns.mapIdx fun i (name, _) =>
356+
let seriesStrokes := fns.mapIdx fun i (name, _) =>
357357
let color := colors.getD (i % colors.size) "#64748b"
358358
(name, color)
359-
359+
360360
mkLineChartFull data seriesStrokes (some xLabel) (some yLabel) w h
361361

362362
/-- Scatter plot with automatic labeling. -/
363-
def scatterSimple {β} [ToFloat β] (f : Float → β) (steps : Nat := 200)
363+
def scatterSimple {β} [ToFloat β] (f : Float → β) (steps : Nat := 200)
364364
(domain : Option (Float × Float) := none) (w h : Nat := 400) : Html :=
365365
let data := sample f steps domain
366366
mkScatterChart data "#dc2626" w h -- Nice red color
367367

368-
/-- Bar chart with automatic labeling. -/
368+
/-- Bar chart with automatic labeling. -/
369369
def barSimple {β} [ToFloat β] (f : Float → β) (steps : Nat := 200)
370370
(domain : Option (Float × Float) := none) (w h : Nat := 400) : Html :=
371-
let data := sample f steps domain
371+
let data := sample f steps domain
372372
mkBarChart data "#16a34a" w h -- Nice green color
373373

374374
/-- Enhanced line chart builder with automatic axis label generation.

LeanPlot/Palette.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ def bluePurple : Color := "#3e4a89"
3030
/-- Medium blue ({lit}`#31688e`). -/
3131
def blue : Color := "#31688e"
3232

33-
/-- Turquoise (#26828e). -/
33+
/-- Turquoise ({lit}`#26828e`). -/
3434
def turquoise : Color := "#26828e"
3535

36-
/-- Green-turquoise (#1f9e89). -/
36+
/-- Green-turquoise ({lit}`#1f9e89`). -/
3737
def greenTurquoise : Color := "#1f9e89"
3838

3939
/-- Green ({lit}`#35b779`). -/

lakefile.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ version = "0.1.0"
55
# Build default
66
defaultTargets = ["leanplot"]
77

8-
# Tell `lake lint` which executable to invoke. Batteries ships a `runLinter` executable
9-
# that understands its extended linting framework, so we delegate to it here.
10-
lintDriver = "batteries/runLinter"
118

129
[leanOptions]
1310
pp.unicode.fun = true

scripts/install.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env bash
2+
# LeanPlot installation script
3+
# Usage: ./scripts/install.sh
4+
5+
set -euo pipefail
6+
7+
echo "=== LeanPlot Setup ==="
8+
9+
# Check for elan
10+
if ! command -v elan &> /dev/null; then
11+
echo "Installing elan (Lean toolchain manager)..."
12+
curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | sh -s -- -y --default-toolchain none
13+
export PATH="$HOME/.elan/bin:$PATH"
14+
else
15+
echo "✓ elan already installed"
16+
fi
17+
18+
# Ensure elan is in PATH
19+
if [[ ":$PATH:" != *":$HOME/.elan/bin:"* ]]; then
20+
export PATH="$HOME/.elan/bin:$PATH"
21+
fi
22+
23+
# Get dependencies and build
24+
echo "Fetching dependencies..."
25+
lake update
26+
27+
echo "Building LeanPlot..."
28+
lake build
29+
30+
echo ""
31+
echo "=== Setup Complete ==="
32+
echo "Run 'just' to see available commands"
33+

0 commit comments

Comments
 (0)