Skip to content

Commit 94b5ceb

Browse files
committed
👷🔧📝 Switch to prek
* Remove pre-commit * Fix Python syntax
1 parent d854493 commit 94b5ceb

24 files changed

Lines changed: 219 additions & 249 deletions

File tree

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# SPDX-License-Identifier: BSD-3-Clause
44

5-
name: pre-commit
5+
name: prek
66

77
on:
88
pull_request:
@@ -16,8 +16,8 @@ concurrency:
1616
permissions: {}
1717

1818
jobs:
19-
pre-commit:
20-
name: pre-commit
19+
prek:
20+
name: prek
2121
# External pull requests should be checked, but not our own internal pull
2222
# requests again, as these are already checked by the push on the branch.
2323
# Without this if condition, the checks would be performed twice, as
@@ -28,12 +28,7 @@ jobs:
2828
github.event.pull_request.head.repo.full_name != github.repository
2929
runs-on: ubuntu-latest
3030
steps:
31-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
31+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
3232
with:
3333
persist-credentials: false
34-
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
35-
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
36-
with:
37-
path: ~/.cache/pre-commit
38-
key: pre-commit|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
39-
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
34+
- uses: j178/prek-action@e98a699c41eb69ab013a45817a0406469a748f8d # v2.0.5

.pre-commit-config.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ci:
1010

1111
repos:
1212
- repo: https://github.com/pre-commit/pre-commit-hooks
13-
rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # v6.0.0
13+
rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0
1414
hooks:
1515
- id: check-json
1616
types: [file] # override `types: [json]`
@@ -24,33 +24,33 @@ repos:
2424
- id: end-of-file-fixer
2525
- id: trailing-whitespace
2626
- repo: https://github.com/tox-dev/pyproject-fmt
27-
rev: 0c8c15d8fe996493035be407c5cf4a288cf6bf8e # v2.25.1
27+
rev: 3632ea90e7641b574983ddf3a11ccedefff3c881 # frozen: v2.25.3
2828
hooks:
2929
- id: pyproject-fmt
3030
- repo: https://github.com/abravalheri/validate-pyproject
31-
rev: 4b2e70d08cb2ccd26d1fba73588de41c7a5d50b7 # v0.25
31+
rev: 4b2e70d08cb2ccd26d1fba73588de41c7a5d50b7 # frozen: v0.25
3232
hooks:
3333
- id: validate-pyproject
3434
- repo: https://github.com/astral-sh/ruff-pre-commit
35-
rev: c59bba8fb259db0fec2bbb77ad8ba51ea7341b56 # v0.15.20
35+
rev: 01a675ea018f2fb714478a5ffb83fcea8374bb06 # frozen: v0.15.21
3636
hooks:
3737
- id: ruff-check
3838
args: [--fix, --exit-non-zero-on-fix]
3939
- id: ruff-format
4040
- repo: https://github.com/sphinx-contrib/sphinx-lint
41-
rev: c883505f64b59c3c5c9375191e4ad9f98e727ccd # v1.0.2
41+
rev: c883505f64b59c3c5c9375191e4ad9f98e727ccd # frozen: v1.0.2
4242
hooks:
4343
- id: sphinx-lint
4444
types: [rst]
4545
- repo: https://github.com/adamchainz/blacken-docs
46-
rev: fda77690955e9b63c6687d8806bafd56a526e45f # 1.20.0
46+
rev: fda77690955e9b63c6687d8806bafd56a526e45f # frozen: 1.20.0
4747
hooks:
4848
- id: blacken-docs
4949
args: [--line-length=79]
5050
additional_dependencies:
5151
- black
5252
- repo: https://github.com/codespell-project/codespell
53-
rev: 2ccb47ff45ad361a21071a7eedda4c37e6ae8c5a # v2.4.2
53+
rev: 2ccb47ff45ad361a21071a7eedda4c37e6ae8c5a # frozen: v2.4.2
5454
hooks:
5555
- id: codespell
5656
args: [--toml pyproject.toml]

CHANGELOG.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ emergencies when we need to start branches for older versions.
2020
`Unreleased <https://github.com/cusyio/Python4DataScience/compare/26.1.0...HEAD>`_
2121
----------------------------------------------------------------------------------
2222

23+
Changed
24+
~~~~~~~
25+
26+
* 👷🔧📝 Switch to prek
27+
28+
* Remove pre-commit
29+
* Fix Python syntax
2330

2431
`26.1.0 <https://github.com/cusyio/Python4DataScience/compare/24.3.0...26.1.0>`_: 2026-07-08
2532
--------------------------------------------------------------------------------------------

README.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ Status
1616
.. image:: https://img.shields.io/github/license/cusyio/Python4DataScience.svg
1717
:alt: License
1818
:target: https://github.com/cusyio/Python4DataScience/blob/main/LICENSES/BSD-3-Clause.txt
19-
.. image:: https://results.pre-commit.ci/badge/github/cusyio/Python4DataScience/main.svg
20-
:target: https://results.pre-commit.ci/repo/github/649815375
21-
:alt: pre-commit.ci status
19+
.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/cusyio/Python4Datascience-de/main/badge-v0.json
20+
:target: https://github.com/j178/prek
21+
:alt: prek
2222
.. image:: https://app.readthedocs.org/projects/python4datascience/badge/?version=latest
2323
:alt: Docs
2424
:target: https://www.python4data.science/en/latest/

badge-v0.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"label": "prek",
3+
"message": "enabled",
4+
"logoSvg": "<svg xmlns=\"http://www.w3.org/2000/svg\" xml:space=\"preserve\" viewBox=\"0 0 150.7 163\"><path fill=\"#fff\" d=\"M84.3 0c-2.6-.3-5.8 10-8.9 10-3 0-6.2-10.1-9-9.8-2.7.4-3.8 11-6.7 11.7-2.9.7-8.5-8.5-11-7.6-2.5 1-1.7 11.8-4.6 13.2-2.8 1.4-9.4-6.6-11.9-5-2.4 1.5 0 11.7-2.4 13.8-2.3 2.1-10.2-3.2-12-1.2-2 2 2.3 11 .5 13.6-1.8 2.6-9.6-.2-11 2.3-1.5 2.5 3.7 9.4 2.5 12.4-1.2 3-9 3.4-9.7 6.2-.8 2.7 5.1 7.9 5.1 10.6.2 3.6-6.8 3.3-3.6 17 2 5.4 2.5 30.7 40.6 48.5-2.2 17.3-7.8 18.5-8.5 23.2.2 3.2 3.7 4.3 4.4 4.1 1.2 0 17-6 28.8-22.2a86.5 86.5 0 0 0 65.2-20 68.7 68.7 0 0 0 18.2-43.5c.7-4.2-4.4-4.4-4.5-7.3-.1-2.8 5.6-7.6 4.8-10.3-.6-4.1-9.1-2.8-9.7-7-.5-3.1 3.6-9.6 2.7-11.5-1.3-2.6-10.1-1-11-2.7-1.5-2.8 2.2-11.1.2-13.2-1.9-2.1-10.3 2.5-11.6 1-2-2.4.3-12-2.7-13.7-3.3-1.8-9.8 6.2-11.6 5-2.6-1.6-2.4-12.4-5-13.4-2.5-1-7.3 8.3-10.2 7.6C88.7 11 86.9.3 84.3 0zM106.8 40c1.4 0 3 1 3.1 2 .2 2.3-.5 1.9-7.8 14-7.2 12.2-27.4 44.6-30.3 50-3 5.7-7.1 10.8-12.2 5.4a569 569 0 0 1-20.6-24c-4.6-5.7-3.6-5.2-3.7-5.5-.1-.4-.7-1.8.9-3.6 3.3-4 6.2-5.4 8.5-6.9 2.4-1.5 2.9-2 5.3.5 2.4 2.4 7.8 10 10.1 12.3 2.4 2.4 2.1 1 9.6-6.4C77.2 70.2 88 57 95.5 49.4c7.5-7.6 8-9.6 11.3-9.5z\"/></svg>",
5+
"logoWidth": 10,
6+
"labelColor": "grey",
7+
"color": "#ff600a"
8+
}

docs/data-processing/intake/gui.ipynb

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5092,21 +5092,15 @@
50925092
],
50935093
"source": [
50945094
"cat.us_crime.plot.bivariate(\n",
5095-
" \"Burglary rate\",\n",
5096-
" \"Property crime rate\",\n",
5097-
" legend=False,\n",
5098-
" width=500,\n",
5099-
" height=400,\n",
5095+
" \"Burglary rate\", \"Property crime rate\", legend=False, width=500, height=400\n",
51005096
") * cat.us_crime.plot.scatter(\n",
51015097
" \"Burglary rate\",\n",
51025098
" \"Property crime rate\",\n",
51035099
" color=\"black\",\n",
51045100
" size=15,\n",
51055101
" legend=False,\n",
51065102
") + cat.us_crime.plot.table(\n",
5107-
" [\"Burglary rate\", \"Property crime rate\"],\n",
5108-
" width=350,\n",
5109-
" height=350,\n",
5103+
" [\"Burglary rate\", \"Property crime rate\"], width=350, height=350\n",
51105104
")"
51115105
]
51125106
},

docs/data-processing/serialisation-formats/toml/pyproject.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ line-length = 79
66

77
[tool.isort]
88
atomic = true
9-
force_grid_wrap = 0
9+
multi_line_output = 3
10+
use_parentheses = true
1011
include_trailing_comma = true
12+
force_grid_wrap = 0
1113
lines_after_imports = 2
1214
lines_between_types = 1
13-
multi_line_output = 3
14-
not_skip = "__init__.py"
15-
use_parentheses = true
16-
known_first_party = [ "MY_FIRST_MODULE", "MY_SECOND_MODULE" ]
1715
known_third_party = [ "mpi4py", "numpy", "requests" ]
16+
known_first_party = [ "MY_FIRST_MODULE", "MY_SECOND_MODULE" ]
17+
not_skip = "__init__.py"

docs/performance/perflint.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,16 @@ Use
3333
$ uv run perflint src/ --load-plugins=perflint
3434
3535
… as pre-commit hook
36-
~~~~~~~~~~~~~~~~~x~~~
36+
~~~~~~~~~~~~~~~~~~~~
3737

38-
perflint can also be used with the
39-
:doc:`/productive/git/advanced/hooks/pre-commit`:
38+
perflint can also be used with the :doc:`/productive/git/advanced/hooks/prek`:
4039

4140
.. code-block:: yaml
4241
:caption: .pre-commit-config.yaml
4342
4443
repos:
4544
- repo: https://github.com/tonybaloney/perflint
46-
rev: 0.8.1
45+
rev: 22f831509bc7765ce272ad6fcb99398d86a26a52 # 0.8.1
4746
hooks:
4847
- id: perflint
4948

docs/productive/dvc/init.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -90,18 +90,18 @@ The corresponding configuration file :file:`.dvc/config` then looks like this:
9090
`Remote Storage
9191
<https://doc.dvc.org/user-guide/data-management/remote-storage>`_
9292

93-
Configure pre-commit
94-
--------------------
93+
Configure prek
94+
--------------
9595

96-
You can check the data managed by DVC with the pre-commit framework before every
97-
``git commit`` and ``git push``, as well as after every ``git checkout``. With
98-
``dvc config --use-pre-commit-tool``, the :file:`.pre-commit-config.yaml` file
99-
receives the following checks:
96+
You can check the data managed by DVC with prek before every ``git commit`` and
97+
``git push``, as well as after every ``git checkout``. With ``dvc config
98+
--use-pre-commit-tool``, the :file:`.pre-commit-config.yaml` file receives the
99+
following checks:
100100

101101
.. code-block:: yaml
102102
103103
- repo: https://github.com/iterative/dvc
104-
rev: 3.63.0
104+
rev: 356dfa03278058b02df42124f243c2c345329dae # 3.67.1
105105
hooks:
106106
- id: dvc-pre-commit
107107
additional_dependencies:
@@ -128,7 +128,7 @@ the ``pre-push`` and ``post-checkout`` hooks:
128128

129129
.. code-block:: console
130130
131-
$ pre-commit install --hook-type pre-commit --hook-type pre-push --hook-type post-checkout
132-
pre-commit installed at .git/hooks/pre-commit
133-
pre-commit installed at .git/hooks/pre-push
134-
pre-commit installed at .git/hooks/post-checkout
131+
$ uv run prek install --hook-type pre-commit --hook-type pre-push --hook-type post-checkout
132+
prek installed at `.git/hooks/pre-commit`
133+
prek installed at `.git/hooks/pre-push`
134+
prek installed at `.git/hooks/post-checkout`

docs/productive/git/advanced/gitlab/ci-cd/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Jobs
6767
.. seealso::
6868
* `GitLab Docs: Jobs <https://docs.gitlab.com/ci/jobs/>`_
6969
* :doc:`python-basics:packs/cibuildwheel`
70-
* :ref:`pre-commit Hooks <pre-commit-in-gitlab-ci>`
70+
* :ref:`pre-commit checks <prek-in-gitlab-ci>`
7171
* :ref:`Licensing <reuse-in-gitlab-ci>`
7272

7373
Stages

0 commit comments

Comments
 (0)