From 197e17b4dd5dc932c1415b33489035aac71af533 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Est=C3=A8ve?= Date: Wed, 14 Oct 2026 05:05:34 +0200 Subject: [PATCH 1/5] MNT Add pre-commit --- .codecov.yml | 1 - .coveragerc | 1 - .github/workflows/test.yml | 10 ++++----- .pre-commit-config.yaml | 21 +++++++++++++++++++ LICENSE | 2 +- .../openmp_helpers_outer.pyx | 2 +- 6 files changed, 27 insertions(+), 10 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.codecov.yml b/.codecov.yml index 50979600..db247200 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -1,2 +1 @@ comment: off - diff --git a/.coveragerc b/.coveragerc index f25962cc..31175756 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,3 +1,2 @@ [run] source=threadpoolctl - diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e295b162..c0257cbf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,15 +30,13 @@ jobs: uses: actions/setup-python@v4 with: python-version: "3.14" + - name: Install ruff run: | - pip install ruff==0.16.8 - - name: Run ruff check - run: | - ruff check . - - name: Run ruff format + pip install pre-commit==4.6.2 + - name: Run pre-commit checks run: | - ruff format --diff . + pre-commit run --all-files --show-diff-on-failure testing: needs: linting diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..b6746861 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,21 @@ +default_language_version: + python: python3 + +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: end-of-file-fixer + - id: trailing-whitespace + - id: check-yaml + - id: check-toml + - id: check-case-conflict + - id: check-added-large-files + - id: detect-private-key + + - repo: https://github.com/charliermarsh/ruff-pre-commit + rev: 'v0.16.8' + hooks: + - id: ruff + args: ["--fix"] + - id: ruff-format diff --git a/LICENSE b/LICENSE index f2927f5f..1d7302bf 100644 --- a/LICENSE +++ b/LICENSE @@ -21,4 +21,4 @@ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/tests/_openmp_test_helper/openmp_helpers_outer.pyx b/tests/_openmp_test_helper/openmp_helpers_outer.pyx index 9e668f5c..8ac5550c 100644 --- a/tests/_openmp_test_helper/openmp_helpers_outer.pyx +++ b/tests/_openmp_test_helper/openmp_helpers_outer.pyx @@ -20,5 +20,5 @@ def check_nested_openmp_loops(int n, nthreads=None): for i in prange(n, num_threads=num_threads, nogil=True): inner_num_threads = inner_openmp_loop(n) outer_num_threads = openmp.omp_get_num_threads() - + return outer_num_threads, inner_num_threads From bb62c60d64164771427cfb3f25085a1d866c2af3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Est=C3=A8ve?= Date: Wed, 14 Oct 2026 05:09:22 +0200 Subject: [PATCH 2/5] test CI lint failure output --- threadpoolctl.py | 1 + 1 file changed, 1 insertion(+) diff --git a/threadpoolctl.py b/threadpoolctl.py index 5ff701ef..5117f395 100644 --- a/threadpoolctl.py +++ b/threadpoolctl.py @@ -15,6 +15,7 @@ import itertools import os import re +import shutil import sys import textwrap import warnings From bc3c957d2e47d920477bc9cf2d0530d61390fb55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Est=C3=A8ve?= Date: Wed, 14 Oct 2026 05:11:06 +0200 Subject: [PATCH 3/5] Revert "test CI lint failure output" This reverts commit bb62c60d64164771427cfb3f25085a1d866c2af3. --- threadpoolctl.py | 1 - 1 file changed, 1 deletion(-) diff --git a/threadpoolctl.py b/threadpoolctl.py index 5117f395..5ff701ef 100644 --- a/threadpoolctl.py +++ b/threadpoolctl.py @@ -15,7 +15,6 @@ import itertools import os import re -import shutil import sys import textwrap import warnings From 02dd3bc5eba0dbb240fbcf3a3c6f00c59f78d0f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Est=C3=A8ve?= Date: Wed, 14 Oct 2026 09:19:30 +0200 Subject: [PATCH 4/5] Tweak --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c0257cbf..29ea90f4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,7 +31,7 @@ jobs: with: python-version: "3.14" - - name: Install ruff + - name: Install pre-commit run: | pip install pre-commit==4.6.2 - name: Run pre-commit checks From 45cf4844c68dd0cbfd3c53b1ed311e883423a1ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Est=C3=A8ve?= Date: Wed, 14 Oct 2026 16:53:51 +0200 Subject: [PATCH 5/5] pre-commit autoupdate --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b6746861..e3120d6e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ default_language_version: repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 + rev: v6.0.0 hooks: - id: end-of-file-fixer - id: trailing-whitespace @@ -14,7 +14,7 @@ repos: - id: detect-private-key - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: 'v0.16.8' + rev: 'v0.17.0' hooks: - id: ruff args: ["--fix"]