Skip to content

Commit a909770

Browse files
authored
Add pre-commit (#74)
Add `pre-commit` to the repo, replacing the existing manual use of `ruff` and `mypy` in github actions. This is more in line with what happens in both `ipython` and `matplotlib`. I have kept `zizmor` as a separate github action.
2 parents 66cf2aa + 44e215c commit a909770

4 files changed

Lines changed: 26 additions & 26 deletions

File tree

‎.github/workflows/main.yml‎

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ concurrency:
1818

1919
jobs:
2020
run:
21+
name: Build and test
2122
runs-on: ${{ matrix.os }}
2223
timeout-minutes: 3
2324

@@ -52,32 +53,8 @@ jobs:
5253
- name: Test installation without nbdime
5354
run: pytest -v
5455

55-
- name: Test flake8
56-
if: ${{ matrix.python-version == '3.14' }}
57-
run: flake8 matplotlib_inline --ignore=E501,W504,W503
58-
5956
- name: Test Build
6057
if: ${{ matrix.python-version == '3.14' }}
6158
run: |
6259
pip install build
6360
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)