File tree Expand file tree Collapse file tree 4 files changed +26
-37
lines changed
Expand file tree Collapse file tree 4 files changed +26
-37
lines changed Original file line number Diff line number Diff line change 1- name : Pre-commit checks
1+ name : Formatting Tests
22
33on :
44 pull_request :
77 - " **/*.py"
88 - " **/*.ipynb"
99 - " .pre-commit-config.yaml"
10+ - " Makefile"
1011 - " pyproject.toml"
1112 pull_request_target :
1213 types : [closed]
1314 paths :
1415 - " **/*.py"
1516 - " **/*.ipynb"
1617 - " .pre-commit-config.yaml"
18+ - " Makefile"
1719 - " pyproject.toml"
1820
19- concurrency :
20- group : pre-commit-${{ github.ref }}z
21- cancel-in-progress : true
22-
2321jobs :
24- pre-commit :
22+ formatting-test :
2523 if : github.event_name != 'pull_request_target' || github.event.pull_request.merged == true
2624 runs-on : ubuntu-latest
2725 permissions :
3836 with :
3937 python-version : " 3.12"
4038
41- - name : Cache pre-commit envs
42- uses : actions/cache@v4
43- with :
44- path : ~/.cache/pre-commit
45- key : pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
46-
4739 - name : Install pre-commit
48- run : pip install pre-commit
40+ run : pip install ruff nbstripout
4941
50- - name : Run pre-commit
51- uses :
pre-commit/[email protected] 52- with :
53- extra_args : --all-files --show-diff-on-failure
42+ - name : Run Formatting Tests
43+ run : make test
Original file line number Diff line number Diff line change 44 - repo : https://github.com/astral-sh/ruff-pre-commit
55 rev : v0.13.0
66 hooks :
7- - id : ruff
8- name : ruff-check
9- args : [--fix, --show-fixes]
10- types_or : [python]
117 - id : ruff-format
128 name : ruff-format
139 types_or : [python]
14-
15- # Import ordering (aligned with Black)
16- - repo : https://github.com/pycqa/isort
17- rev : 6.0.1
18- hooks :
19- - id : isort
20- types_or : [python]
21-
22- # Canonical Python formatter
23- - repo : https://github.com/psf/black
24- rev : 24.8.0
25- hooks :
26- - id : black
27- types_or : [python]
28-
2910 # Strip notebook outputs anywhere in repo
3011 - repo : https://github.com/kynan/nbstripout
3112 rev : 0.8.1
@@ -39,4 +20,4 @@ exclude: |
3920 ^\.venv/|^venv/|
4021 ^\.pytest_cache/|^\.mypy_cache/|
4122 ^\.ipynb_checkpoints/
42- )
23+ )
Original file line number Diff line number Diff line change 1+ .PHONY : lint nbcleanup test
2+
3+ USE_CASES := $(wildcard notebooks/use-cases/* .ipynb)
4+ TUTORIALS := $(wildcard notebooks/tutorials/* .ipynb)
5+ ALL_NOTEBOOKS := $(USE_CASES ) $(TUTORIALS )
6+
7+ lint :
8+ @echo " Running ruff format..."
9+ ruff format
10+
11+ nbcleanup :
12+ @echo " Running nbstripout..."
13+ nbstripout $(ALL_NOTEBOOKS )
14+
15+ test : lint nbcleanup
16+ @echo " All test completed successfully :)"
Original file line number Diff line number Diff line change 1+ ruff
2+ nbstripout
You can’t perform that action at this time.
0 commit comments