-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathJustfile
More file actions
122 lines (92 loc) · 2.8 KB
/
Justfile
File metadata and controls
122 lines (92 loc) · 2.8 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
110
111
112
113
114
115
116
117
118
119
120
121
122
# Set the shell to use
# set shell := ["nu", "-c"]
# Set shell for Windows
set windows-shell := ["powershell.exe", "-NoLogo", "-Command"]
# Set path to virtual environment's python
venv_dir := ".venv"
python := venv_dir + if os_family() == "windows" { "/Scripts/python.exe" } else { "/bin/python3" }
# Display system information
system-info:
@echo "CPU architecture: {{ arch() }}"
@echo "Operating system type: {{ os_family() }}"
@echo "Operating system: {{ os() }}"
# Clean venv
clean:
rm -rf .venv
# Setup environment
get-started: pre-install venv
# Update project software versions in requirements
update-reqs:
uv lock
pre-commit autoupdate
# create virtual environment
venv:
uv sync
uv tool install pre-commit
uv run pre-commit install
activate-venv:
uv shell
# launch jupyter lab
lab:
uv run jupyter lab
# Preview the quarto project at path
preview-docs path:
quarto preview {{ path }}
# Build the quarto project at path
build-docs path:
quarto render {{ path }}
# Lint python code
lint-py:
uv run ruff check
# Format python code
fmt-python:
uv run ruff format
# Format a single python file, "f"
fmt-py f:
uv run ruff format {{ f }}
# Lint sql scripts
lint-sql:
uv run sqlfluff fix --dialect duckdb
# Report vale errors for a file
vale-errors f:
vale --filter='.Level in ["error"]' {{ f }}
# Report vale warnings for a file
vale-warnings f:
vale --filter='.Level in ["warning"]' {{ f }}
# Report vale suggestions for a file
vale-suggestions f:
vale --filter='.Level in ["suggestion"]' {{ f }}
# Report vale errors, warnings, and suggestions for a file
vale-file f:
vale {{ f }}
# Report all vale errors in repository
vale-errors-all:
vale --filter='.Level in ["error"]' --glob='*.qmd' .
# Report all vale errors in repository
vale-warnings-all:
vale --filter='.Level in ["warning"]' --glob='*.qmd' .
# Format all markdown and config files
fmt-markdown:
markdownlint-cli2 --config {{ justfile_directory() }}/.markdownlint.yaml "**/*.{md,qmd}" "#.venv" --fix
# Format a single markdown file, "f"
fmt-md f:
markdownlint-cli2 --config {{ justfile_directory() }}/.markdownlint.yaml {{ f }} --fix
# Check format of all markdown files
fmt-check-markdown:
markdownlint-cli2 --config {{ justfile_directory() }}/.markdownlint.yaml "**/*.{md,qmd}" "#.venv"
fmt-all: lint-py fmt-python lint-sql fmt-markdown
# Run pre-commit hooks
pre-commit-run:
pre-commit run
[windows]
pre-install:
winget install Casey.Just astral-sh.uv GitHub.cli Posit.Quarto Posit.Positron OpenJS.NodeJS DuckDB.cli
npm install -g markdownlint-cli2
[linux]
pre-install:
brew install just uv gh markdownlint-cli2 duckdb
[macos]
pre-install:
brew install just uv gh markdownlint-cli2 duckdb
brew install --cask quarto
brew install --cask positron