Skip to content

Commit 3450429

Browse files
Merge branch 'master' into docs-prompt-docstring
2 parents 347d047 + f3f599a commit 3450429

7 files changed

Lines changed: 20 additions & 9 deletions

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
cache-dependency-glob: uv.lock
1818
- uses: actions/setup-python@v7
1919
with:
20-
python-version: 3.14
20+
python-version-file: pyproject.toml
2121
allow-prereleases: true
2222
- run: uv sync --group=test
2323
- name: Run tests

.github/workflows/directory_writer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
fetch-depth: 0
1212
- uses: actions/setup-python@v7
1313
with:
14-
python-version: 3.14
14+
python-version-file: pyproject.toml
1515
allow-prereleases: true
1616
- name: Write DIRECTORY.md
1717
run: |

.github/workflows/project_euler.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- uses: astral-sh/setup-uv@v7
2626
- uses: actions/setup-python@v7
2727
with:
28-
python-version: 3.14
28+
python-version-file: pyproject.toml
2929
allow-prereleases: true
3030
- run: uv sync --group=euler-validate --group=test
3131
- run: uv run pytest --doctest-modules --cov-report=term-missing:skip-covered --cov=project_euler/ project_euler/
@@ -43,7 +43,7 @@ jobs:
4343
- uses: astral-sh/setup-uv@v7
4444
- uses: actions/setup-python@v7
4545
with:
46-
python-version: 3.14
46+
python-version-file: pyproject.toml
4747
allow-prereleases: true
4848
- run: uv sync --group=euler-validate --group=test
4949
- run: uv run pytest scripts/validate_solutions.py

.github/workflows/sphinx.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
- uses: astral-sh/setup-uv@v7
3737
- uses: actions/setup-python@v7
3838
with:
39-
python-version: 3.14
39+
python-version-file: pyproject.toml
4040
allow-prereleases: true
4141
- run: uv sync --group=docs
4242
- uses: actions/configure-pages@v6

.pre-commit-config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
ci:
22
autoupdate_schedule: monthly
3+
# uv-lock resolves dependencies from PyPI, but pre-commit.ci runs hooks with no
4+
# network access, so it fails there. Skip it on pre-commit.ci; it still runs locally.
5+
skip: [uv-lock]
36

47
repos:
58
- repo: https://github.com/pre-commit/pre-commit-hooks
@@ -18,6 +21,11 @@ repos:
1821
hooks:
1922
- id: auto-walrus
2023

24+
- repo: https://github.com/astral-sh/uv-pre-commit
25+
rev: 0.12.7
26+
hooks:
27+
- id: uv-lock
28+
2129
- repo: https://github.com/astral-sh/ruff-pre-commit
2230
rev: v0.16.1
2331
hooks:

machine_learning/automatic_differentiation.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@
1212
from collections import defaultdict
1313
from enum import Enum
1414
from types import TracebackType
15-
from typing import Any
15+
from typing import Any, Self
1616

1717
import numpy as np
18-
from typing_extensions import Self # noqa: UP035
1918

2019

2120
class OpType(Enum):

physics/in_static_equilibrium.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from __future__ import annotations
66

7-
from numpy import array, cos, cross, float64, radians, sin
7+
from numpy import array, cos, float64, radians, sin
88
from numpy.typing import NDArray
99

1010

@@ -51,7 +51,11 @@ def in_static_equilibrium(
5151
False
5252
"""
5353
# summation of moments is zero
54-
moments: NDArray[float64] = cross(location, forces)
54+
# NumPy 2.x removed the 2-D cross product, so compute the scalar
55+
# (z-axis) moment for each row directly: x_i * Fy_i - y_i * Fx_i.
56+
moments: NDArray[float64] = (
57+
location[:, 0] * forces[:, 1] - location[:, 1] * forces[:, 0]
58+
)
5559
sum_moments: float = sum(moments)
5660
return bool(abs(sum_moments) < eps)
5761

0 commit comments

Comments
 (0)