Skip to content

Commit 0e1bae8

Browse files
committed
* 👷🔧📝 Switch to prek
* Remove pre-commit
1 parent 18d7d71 commit 0e1bae8

9 files changed

Lines changed: 35 additions & 26 deletions

File tree

.github/workflows/ci.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,22 @@ concurrency:
1212
permissions: {}
1313

1414
jobs:
15-
pre-commit:
16-
name: pre-commit
15+
prek:
16+
name: prek
17+
# External pull requests should be checked, but not our own internal pull
18+
# requests again, as these are already checked by the push on the branch.
19+
# Without this if condition, the checks would be performed twice, as
20+
# internal pull requests correspond to both the push and pull_request
21+
# events.
22+
if:
23+
github.event_name == 'push' ||
24+
github.event.pull_request.head.repo.full_name != github.repository
1725
runs-on: ubuntu-latest
1826
steps:
1927
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
2028
with:
2129
persist-credentials: false
22-
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
23-
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
24-
with:
25-
path: ~/.cache/pre-commit
26-
key: pre-commit|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
27-
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
30+
- uses: j178/prek-action@e98a699c41eb69ab013a45817a0406469a748f8d # v2.0.5
2831

2932
docs:
3033
name: Build docs and check links

CHANGELOG.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ emergencies when we need to start branches for older versions.
1616
`Unreleased <https://github.com/veit/python-basics-tutorial-de/compare/25.1.0...HEAD>`_
1717
---------------------------------------------------------------------------------------
1818

19+
Changed
20+
~~~~~~~
21+
22+
* 👷🔧📝 Switch to prek
23+
24+
* Remove pre-commit
25+
1926
`25.1.0 <https://github.com/veit/python-basics-tutorial/compare/24.3.0...25.1.0>`_
2027
----------------------------------------------------------------------------------
2128

@@ -35,7 +42,6 @@ Added
3542
Changed
3643
~~~~~~~
3744

38-
3945
* 📝 Update cookiecutter templates
4046

4147
* Add badges

docs/document/sphinx/test.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ reST formatting
144144
Whether the :doc:`Sphinx <start>` documentation is written in valid :doc:`rest`
145145
format can be checked with `sphinx-lint
146146
<https://pypi.org/project/sphinx-lint/>`_. We usually include this in our
147-
:doc:`pre-commit
148-
<Python4DataScience:productive/git/advanced/hooks/pre-commit>` configuration:
147+
:doc:`prek <Python4DataScience:productive/git/advanced/hooks/prek>`
148+
configuration:
149149

150150
.. code-block:: yaml
151151
:caption: .pre-commit-config.yaml
@@ -194,10 +194,10 @@ Code formatting
194194
The formatting of code blocks can be checked with `blacken-docs
195195
<https://github.com/adamchainz/blacken-docs>`_, which uses
196196
:doc:`Python4DataScience:productive/qa/black`. We usually integrate the library
197-
via the :doc:`pre-commit
198-
<Python4DataScience:productive/git/advanced/hooks/pre-commit>` framework:
197+
via :doc:`prek <Python4DataScience:productive/git/advanced/hooks/prek>`:
199198

200199
.. code-block:: yaml
200+
:caption: .pre-commit-config.yaml
201201
202202
- repo: https://github.com/adamchainz/blacken-docs
203203
rev: 7ae9389351f4090e3993de28015a05a18ca6b8a7 # v1.12.1
@@ -310,8 +310,8 @@ You should then update your :ref:`.gitignore <gitignore>` file if necessary:
310310
311311
styles/*
312312
313-
You can configure Vale for the :doc:`pre-commit
314-
<Python4DataScience:productive/git/advanced/hooks/pre-commit>` framework with:
313+
You can configure Vale for :doc:`prek
314+
<Python4DataScience:productive/git/advanced/hooks/prek>` with:
315315

316316
.. code-block:: yaml
317317
:caption: .pre-commit-config.yaml
@@ -381,8 +381,8 @@ example with
381381
commands =
382382
interrogate --quiet --fail-under 95 src tests
383383
384-
You can also use ``interrogate`` with :doc:`pre-commit
385-
<Python4DataScience:productive/git/advanced/hooks/pre-commit>`:
384+
You can also use ``interrogate`` with :doc:`prek
385+
<Python4DataScience:productive/git/advanced/hooks/prek>`:
386386

387387
.. code-block:: yaml
388388
:caption: .pre-commit-config.yaml

docs/packs/apps.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,8 @@ specific version.
149149
$ uv sync --exclude-newer-package "{PACKAGE}=P0D"
150150
151151
.. tip::
152-
You can also use the
153-
:doc:`Python4DataScience:productive/git/advanced/hooks/pre-commit` to
154-
regularly update your :file:`uv.lock` file:
152+
You can also use :doc:`Python4DataScience:productive/git/advanced/hooks/prek`
153+
to regularly update your :file:`uv.lock` file:
155154

156155
.. code-block:: yaml
157156
:caption: .pre-commit-config.yaml
@@ -160,6 +159,7 @@ specific version.
160159
rev: 6a280ba12b7901e47757c868c8c13c6a624c9ecb # 0.11.7
161160
hooks:
162161
- id: uv-lock
162+
args: ["--exclude-newer = 'P3D'", "--quiet"]
163163
164164
Restrict platform and Python versions
165165
-------------------------------------

docs/packs/dataprep/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ License-File = [ "LICENSE" ]
3131

3232
[dependency-groups]
3333
dev = [
34-
"pre-commit",
34+
"prek",
3535
{ include-group = "docs" },
3636
{ include-group = "tests" },
3737
]

docs/packs/distribution.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ Dependency groups
317317

318318
Recursive dependency groups are also possible. For example, for ``dev`` you can
319319
take over all dependencies from ``docs`` and ``test`` in addition to
320-
``pre-commit``:
320+
``prek``:
321321

322322
.. literalinclude:: dataprep/pyproject.toml
323323
:language: toml

docs/packs/templating/cruft.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ Checking a project
7979
To see if a project has missed a template update, you can easily call ``cruft
8080
check``. If the project is out of date, an error and exit code 1 will be
8181
returned. ``cruft check`` can also be added to
82-
:doc:`Python4DataScience:productive/git/advanced/hooks/pre-commit` and CI
83-
pipelines to ensure projects don’t become unintentionally stale.
82+
:doc:`Python4DataScience:productive/git/advanced/hooks/prek` and CI pipelines to
83+
ensure projects don’t become unintentionally stale.
8484

8585
Linking an existing project
8686
---------------------------

docs/test/tox.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ We can also call individual tests with tox by making another change so that
370370
[tool.tox]
371371
requires = [ "tox>=4" ]
372372
env_list = [
373-
"pre-commit",
373+
"prek",
374374
"docs",
375375
"py3{10-14}",
376376
"py{13-14}t",

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ urls.Homepage = "https://github.com/veit/python-basics-tutorial/"
2525
[dependency-groups]
2626
dev = [
2727
"codespell",
28-
"pre-commit",
28+
"prek",
2929
"vale",
3030
{ include-group = "docs" },
3131
]

0 commit comments

Comments
 (0)