Skip to content

Commit e177f15

Browse files
committed
⬆️ Update pre-commit hooks
* Switch to SHA values instead of git tags * Upgrade to isort 5 * Use black config for isort
1 parent 1620cfe commit e177f15

File tree

7 files changed

+58
-55
lines changed

7 files changed

+58
-55
lines changed

.pre-commit-config.yaml

Lines changed: 9 additions & 9 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: v6.0.0
13+
rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # v6.0.0
1414
hooks:
1515
- id: check-json
1616
types: [file] # override `types: [json]`
@@ -24,43 +24,43 @@ repos:
2424
- id: end-of-file-fixer
2525
- id: trailing-whitespace
2626
- repo: https://github.com/tox-dev/pyproject-fmt
27-
rev: v2.16.2
27+
rev: 6e10264313f53d6247a8b1b984f5b5ccf50ba539 # v2.21.0
2828
hooks:
2929
- id: pyproject-fmt
3030
- repo: https://github.com/abravalheri/validate-pyproject
31-
rev: v0.25
31+
rev: 4b2e70d08cb2ccd26d1fba73588de41c7a5d50b7 # v0.25
3232
hooks:
3333
- id: validate-pyproject
3434
- repo: https://github.com/sphinx-contrib/sphinx-lint
35-
rev: v1.0.2
35+
rev: c883505f64b59c3c5c9375191e4ad9f98e727ccd # v1.0.2
3636
hooks:
3737
- id: sphinx-lint
3838
types: [rst]
3939
- repo: https://github.com/pycqa/isort
40-
rev: 8.0.1
40+
rev: a333737ed43df02b18e6c95477ea1b285b3de15a # 8.0.1
4141
hooks:
4242
- id: isort
4343
additional_dependencies: ["toml"]
4444
entry: isort --profile=black
4545
name: isort (python)
4646
- repo: https://github.com/psf/black-pre-commit-mirror
47-
rev: 26.1.0
47+
rev: fa505ab9c3e0fedafe1709fd7ac2b5f8996c670d # 26.3.1
4848
hooks:
4949
- id: black
5050
- repo: https://github.com/tonybaloney/perflint
51-
rev: 0.8.1
51+
rev: 22f831509bc7765ce272ad6fcb99398d86a26a52 # 0.8.1
5252
hooks:
5353
- id: perflint
5454
exclude: ^docs/
5555
- repo: https://github.com/adamchainz/blacken-docs
56-
rev: "1.20.0"
56+
rev: fda77690955e9b63c6687d8806bafd56a526e45f # 1.20.0
5757
hooks:
5858
- id: blacken-docs
5959
args: [--line-length=79]
6060
additional_dependencies:
6161
- black
6262
- repo: https://github.com/codespell-project/codespell
63-
rev: v2.4.1
63+
rev: 2ccb47ff45ad361a21071a7eedda4c37e6ae8c5a # v2.4.2
6464
hooks:
6565
- id: codespell
6666
args: [--toml pyproject.toml]

docs/data-processing/postgresql/db-api.rst

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,29 +26,20 @@ Connection
2626

2727
Example:
2828

29-
.. blacken-docs:off
30-
3129
.. code-block:: python
3230
3331
import driver
3432
35-
36-
conn = driver.connect(
37-
database="example",
38-
host="localhost",
39-
port=5432
40-
)
33+
conn = driver.connect(database="example", host="localhost", port=5432)
4134
try:
42-
# create the cursor
43-
# use the cursor
35+
cursor = conn.cursor()
36+
cursor.execute("SQL-STATEMENT")
4437
except Exception:
4538
conn.rollback()
4639
else:
4740
conn.commit()
4841
conn.close()
4942
50-
.. blacken-docs:on
51-
5243
Cursor
5344
`Cursor objects <https://peps.python.org/pep-0249/#cursor-objects>`_ are
5445
used to manage the context of a ``.fetch*()`` method.
@@ -82,12 +73,10 @@ Cursor
8273
.. code-block:: python
8374
8475
cursor = conn.cursor()
85-
cursor.execute(
86-
"""
76+
cursor.execute("""
8777
SELECT column1, column2
8878
FROM tableA
89-
"""
90-
)
79+
""")
9180
for column1, column2 in cursor.fetchall():
9281
print(column1, column2)
9382

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# SPDX-FileCopyrightText: 2022 Veit Schiele
22
#
33
# SPDX-License-Identifier: BSD-3-Clause
4-
54
[tool.black]
65
line-length = 79
76

@@ -14,6 +13,5 @@ lines_between_types = 1
1413
multi_line_output = 3
1514
not_skip = "__init__.py"
1615
use_parentheses = true
17-
1816
known_first_party = [ "MY_FIRST_MODULE", "MY_SECOND_MODULE" ]
1917
known_third_party = [ "mpi4py", "numpy", "requests" ]

docs/productive/envs/spack/combinatorial-builds.rst

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -169,32 +169,47 @@ Spack provides a ``spec`` syntax for describing custom DAGs:
169169
170170
from spack import *
171171
172+
172173
class Dyninst(Package):
173-
"""API for dynamic binary instrumentation.""”
174+
"""API for dynamic binary instrumentation."""
175+
174176
homepage = "https://paradyn.org"
175177
176-
version('8.2.1', 'abf60b7faabe7a2e’, url="http://www.paradyn.org/release8.2/DyninstAPI-8.2.1.tgz")
177-
version('8.1.2', 'bf03b33375afa66f’, url="http://www.paradyn.org/release8.1.2/DyninstAPI-8.1.2.tgz")
178-
version('8.1.1', 'd1a04e995b7aa709’, url="http://www.paradyn.org/release8.1/DyninstAPI-8.1.1.tgz")
178+
version(
179+
"8.2.1",
180+
"abf60b7faabe7a2e",
181+
url="http://www.paradyn.org/release8.2/DyninstAPI-8.2.1.tgz",
182+
)
183+
version(
184+
"8.1.2",
185+
"bf03b33375afa66f",
186+
url="http://www.paradyn.org/release8.1.2/DyninstAPI-8.1.2.tgz",
187+
)
188+
version(
189+
"8.1.1",
190+
"d1a04e995b7aa709",
191+
url="http://www.paradyn.org/release8.1/DyninstAPI-8.1.1.tgz",
192+
)
179193
180194
depends_on("libelf")
181195
depends_on("libdwarf")
182196
depends_on("boost@1.42:")
183197
184198
def install(self, spec, prefix):
185-
libelf = spec['libelf'].prefix
186-
libdwarf = spec['libdwarf'].prefix
187-
188-
with working_dir('spack-build', create=True):
189-
cmake('..',
190-
'-DBoost_INCLUDE_DIR=%s' % spec['boost'].prefix.include,
191-
'-DBoost_LIBRARY_DIR=%s' % spec['boost'].prefix.lib,
192-
'-DBoost_NO_SYSTEM_PATHS=TRUE’
193-
*std_cmake_args)
199+
libelf = spec["libelf"].prefix
200+
libdwarf = spec["libdwarf"].prefix
201+
202+
with working_dir("spack-build", create=True):
203+
cmake(
204+
"..",
205+
"-DBoost_INCLUDE_DIR=%s" % spec["boost"].prefix.include,
206+
"-DBoost_LIBRARY_DIR=%s" % spec["boost"].prefix.lib,
207+
"-DBoost_NO_SYSTEM_PATHS=TRUE" * std_cmake_args,
208+
)
194209
make()
195210
make("install")
196211
197-
@when('@:8.1')
212+
@when("@:8.1")
198213
def install(self, spec, prefix):
199214
configure("--prefix=" + prefix)
200215
make()
@@ -258,7 +273,7 @@ Spack provides a ``spec`` syntax for describing custom DAGs:
258273
mpich: aa4ar6ifj23yijqmdabeakpejcli72t3
259274
hash: 33hjjhxi7p6gyzn5ptgyes7sghyprujh
260275
variants: {}
261-
version: '1.0'
276+
version: "1.0"
262277
- adept-utils:
263278
arch: linux-x86_64
264279
compiler:

docs/productive/git/advanced/bisect.rst

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,33 +130,29 @@ complicated changes in behaviour. For performance tests, we need a test
130130
programme that can perform multiple runs and determine the minimum time while
131131
eliminating possible noise:
132132

133-
.. blacken-docs:off
134-
135133
.. code-block:: python
136134
137135
from subprocess import run
138136
from time import perf_counter
139137
140-
141138
times = []
142139
for _ in range(10):
143140
start = perf_counter()
144141
run(
145-
[./perftest, PARAM],
142+
"./perftest",
143+
PARAM,
146144
check=True,
147145
capture_output=True,
148146
)
149147
elapsed = perf_counter() - start
150148
times.append(elapsed)
151-
if min(times) > X.0:
149+
if min(times) > 2.0:
152150
print("Too slow")
153151
raise SystemExit(1)
154152
else:
155153
print("Fast enough")
156154
raise SystemExit(0)
157155
158-
.. blacken-docs:on
159-
160156
The programme executes :samp:`python perftest.py {PARAM}` ten times and measures
161157
the time for each execution. It then compares the minimum execution time with a
162158
limit value of ``X`` seconds. If the minimum time is above the limit value, it

docs/workspace/ipython/extensions.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,19 +54,18 @@ Writing IPython extensions
5454
An IPython extension is an importable Python module that has special functions
5555
for loading and unloading:
5656

57-
.. blacken-docs:off
58-
5957
.. code-block:: python
6058
6159
def load_ipython_extension(ipython):
6260
# The `ipython` argument is the currently active `InteractiveShell`
6361
# instance, which can be used in any way. This allows you to register
6462
# new magics or aliases, for example.
63+
pass
64+
6565
6666
def unload_ipython_extension(ipython):
6767
# If you want your extension to be unloadable, put that logic here.
68-
69-
.. blacken-docs:on
68+
pass
7069
7170
.. seealso::
72-
* :label:`defining_magics`
71+
* :label:`defining_magics`

pyproject.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# SPDX-FileCopyrightText: 2020 Veit Schiele
2+
#
3+
# SPDX-License-Identifier: BSD-3-Clause
14
[project]
25
name = "python4datascience"
36
version = "24.2.0"
@@ -20,7 +23,7 @@ classifiers = [
2023
]
2124
dependencies = []
2225
urls."Bug Tracker" = "https://github.com/cusyio/Python4DataScience/issues"
23-
urls."Homepage" = "https://github.com/cusyio/Python4DataScience/"
26+
urls.Homepage = "https://github.com/cusyio/Python4DataScience/"
2427

2528
[dependency-groups]
2629
dev = [
@@ -50,6 +53,9 @@ docs = [
5053
[tool.setuptools]
5154
packages = []
5255

56+
[tool.black]
57+
line-length = 79
58+
5359
[tool.codespell]
5460
skip = "*.csv, *.html, *.pdf, *.ipynb, ./docs/_build/*, ./styles/*"
5561
ignore-words-list = "AAS, ans, bund, comit, fo, Groth, nd, Ned, ORE, ore, Redict, redict, registr, reStructedText, splitted"

0 commit comments

Comments
 (0)