From a6a6833d6e30864916165764dd01504234143455 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 1 Aug 2026 09:43:27 +0000 Subject: [PATCH 1/2] Bump actions/setup-python from 6 to 7 in the action-dependencies group Bumps the action-dependencies group with 1 update: [actions/setup-python](https://github.com/actions/setup-python). Updates `actions/setup-python` from 6 to 7 - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/v6...v7) --- updated-dependencies: - dependency-name: actions/setup-python dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major dependency-group: action-dependencies ... Signed-off-by: dependabot[bot] --- .github/workflows/build.yml | 2 +- .github/workflows/docs.yml | 2 +- .github/workflows/lint.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/tests.yml | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 72eda084..0f8dde3e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,7 +16,7 @@ jobs: with: fetch-depth: 0 - name: setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: "3.14" - run: python -m pip install tox diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 5a9ef11c..21d337a8 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -17,7 +17,7 @@ jobs: with: fetch-depth: 0 - name: setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: "3.14" - name: install dependencies diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 60eddc72..8e7b763c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -11,7 +11,7 @@ jobs: steps: - uses: actions/checkout@v7 - name: Set up Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: "3.14" - run: python -m pip install tox diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 282bb04f..64d484ec 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,7 +20,7 @@ jobs: with: fetch-depth: 0 - name: setup Python - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: "3.14" - run: python -m pip install tox diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 50936bc4..3be2e71e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -26,7 +26,7 @@ jobs: with: fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: ${{ matrix.python-version }} - name: activate MSVC (for torch.compile) @@ -55,7 +55,7 @@ jobs: with: fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v6 + uses: actions/setup-python@v7 with: python-version: ${{ matrix.python-version }} - name: activate MSVC (for torch.compile / inductor codegen) From 7a22f9945dd69ba2380855457db9c964566f20f2 Mon Sep 17 00:00:00 2001 From: Philip Loche Date: Mon, 3 Aug 2026 11:04:46 +0200 Subject: [PATCH 2/2] Fix linter and testsuite --- pyproject.toml | 3 ++- src/torchpme/lib/mesh_interpolator.py | 10 +++++++++- tox.ini | 3 +-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 85b8378c..984fb907 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -107,10 +107,11 @@ line-length = 88 [tool.ruff.lint] # See https://docs.astral.sh/ruff/rules for additional details -extend-select = [ +select = [ "B", # Pyflakes checks (e.g., unused imports, undefined variables) "D", # PEP 257 docstring conventions (e.g., formatting, consistency) "E", # Pycodestyle errors (e.g., indentation, whitespace, syntax) + "F", # Pyflakes (e.g., unused imports, undefined names) "UP", # PyUpgrade rules (e.g., upgrading to modern Python syntax) "I", # Import conventions (e.g., sorting imports, duplicate imports) "SIM", # Simplification suggestions (e.g., refactoring redundant code) diff --git a/src/torchpme/lib/mesh_interpolator.py b/src/torchpme/lib/mesh_interpolator.py index da53ae6e..0f6e6e40 100644 --- a/src/torchpme/lib/mesh_interpolator.py +++ b/src/torchpme/lib/mesh_interpolator.py @@ -1,6 +1,14 @@ import torch +# Runs eagerly: Inductor's CPU backend spuriously raises ZeroDivisionError on +# vectorized `%` with an odd-length divisor (here always 3), see +# https://github.com/pytorch/pytorch/issues/143649 +@torch.compiler.disable +def _mesh_index_remainder(indices: torch.Tensor, ns_mesh: torch.Tensor) -> torch.Tensor: + return indices % ns_mesh + + class MeshInterpolator(torch.nn.Module): """ Class for handling all steps related to interpolations in the context of a mesh @@ -349,7 +357,7 @@ def compute_weights(self, positions: torch.Tensor): # below. indices_to_interpolate = torch.stack( [ - (positions_rel_idx + i) % self.ns_mesh + _mesh_index_remainder(positions_rel_idx + i, self.ns_mesh) for i in range( 1 - (self.interpolation_nodes + 1) // 2, 1 + self.interpolation_nodes // 2, diff --git a/tox.ini b/tox.ini index 31e65772..9e37ea82 100644 --- a/tox.ini +++ b/tox.ini @@ -21,8 +21,7 @@ deps = twine allowlist_externals = bash commands_pre = - bash -c "if [ -e {toxinidir}/dist/*tar.gz ]; then unlink {toxinidir}/dist/*.whl; fi" - bash -c "if [ -e {toxinidir}/dist/*tar.gz ]; then unlink {toxinidir}/dist/*.tar.gz; fi" + bash -c "rm -f {toxinidir}/dist/*.whl {toxinidir}/dist/*.tar.gz" commands = python -m build twine check dist/*.tar.gz dist/*.whl