Skip to content

Commit 4b97bed

Browse files
committed
Add pre-commit
1 parent 66cf2aa commit 4b97bed

4 files changed

Lines changed: 46 additions & 28 deletions

File tree

‎.github/workflows/main.yml‎

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
name: Tests
2-
31
on:
42
push:
53
branches:
@@ -17,7 +15,28 @@ concurrency:
1715
cancel-in-progress: true
1816

1917
jobs:
18+
pre-commit:
19+
name: Pre-commit
20+
runs-on: ubuntu-latest
21+
timeout-minutes: 5
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
26+
with:
27+
persist-credentials: false
28+
29+
- name: Setup Python
30+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
31+
with:
32+
python-version: "3.14"
33+
34+
- name: Run pre-commit
35+
run: pipx run pre-commit run --all-files --show-diff-on-failure
36+
2037
run:
38+
name: Tests
39+
needs: pre-commit
2140
runs-on: ${{ matrix.os }}
2241
timeout-minutes: 3
2342

@@ -52,32 +71,8 @@ jobs:
5271
- name: Test installation without nbdime
5372
run: pytest -v
5473

55-
- name: Test flake8
56-
if: ${{ matrix.python-version == '3.14' }}
57-
run: flake8 matplotlib_inline --ignore=E501,W504,W503
58-
5974
- name: Test Build
6075
if: ${{ matrix.python-version == '3.14' }}
6176
run: |
6277
pip install build
6378
python -m build
64-
65-
- name: Install ruff
66-
if: ${{ matrix.python-version == '3.14' }}
67-
run: pip install ruff
68-
69-
- name: Check code with ruff
70-
if: ${{ matrix.python-version == '3.14' }}
71-
run: ruff check matplotlib_inline
72-
73-
- name: Check formatting with ruff
74-
if: ${{ matrix.python-version == '3.14' }}
75-
run: ruff format matplotlib_inline --check
76-
77-
- name: install Mypy
78-
if: ${{ matrix.python-version == '3.14' }}
79-
run : pip install mypy matplotlib
80-
81-
- name: run mypy
82-
if: ${{ matrix.python-version == '3.14' }}
83-
run: mypy .

‎.github/workflows/publish.yml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,3 @@ jobs:
4444
fi
4545
- name: Publish package
4646
uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
47-

‎.pre-commit-config.yaml‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v6.0.0
4+
hooks:
5+
- id: check-added-large-files
6+
- id: check-merge-conflict
7+
- id: check-toml
8+
- id: check-yaml
9+
- id: debug-statements
10+
- id: end-of-file-fixer
11+
exclude: \.ipynb$
12+
- id: trailing-whitespace
13+
exclude: \.ipynb$
14+
- repo: https://github.com/astral-sh/ruff-pre-commit
15+
rev: v0.17.3
16+
hooks:
17+
- id: ruff-check
18+
exclude: \.ipynb$
19+
- id: ruff-format
20+
exclude: \.ipynb$
21+
- repo: https://github.com/pre-commit/mirrors-mypy
22+
rev: v2.4.0
23+
hooks:
24+
- id: mypy
25+
additional_dependencies: [matplotlib, traitlets]

‎pyproject.toml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ inline = "matplotlib_inline.backend_inline"
4949

5050
[project.optional-dependencies]
5151
test = [
52-
"flake8",
5352
"nbdime",
5453
"nbval",
5554
"notebook",

0 commit comments

Comments
 (0)