diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b99daa4..a809cff 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,41 +12,14 @@ jobs: fail-fast: false matrix: os: [ ubuntu-latest ] - python-version: [ "3.10", "3.11", "3.12", "3.13", "3.14" ] - numpy-version: [ "1.24", "1.25", "1.26", "2.0", "2.1", "2.2", "2.3", "2.4" ] + python-version: [ "3.11", "3.12", "3.13", "3.14", "3.15" ] + numpy-version: [ "2.0", "2.1", "2.2", "2.3", "2.4", "2.5" ] exclude: - - python-version: "3.10" - numpy-version: "2.3" - os: ubuntu-latest - - python-version: "3.10" - numpy-version: "2.4" - os: ubuntu-latest - python-version: "3.11" numpy-version: "2.4" os: ubuntu-latest - - python-version: "3.12" - numpy-version: "1.24" - os: ubuntu-latest - - python-version: "3.12" - numpy-version: "1.25" - os: ubuntu-latest - - python-version: "3.13" - numpy-version: "1.24" - os: ubuntu-latest - - python-version: "3.13" - numpy-version: "1.25" - os: ubuntu-latest - - python-version: "3.13" - numpy-version: "1.26" - os: ubuntu-latest - - python-version: "3.14" - numpy-version: "1.24" - os: ubuntu-latest - - python-version: "3.14" - numpy-version: "1.25" - os: ubuntu-latest - - python-version: "3.14" - numpy-version: "1.26" + - python-version: "3.11" + numpy-version: "2.5" os: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -76,7 +49,7 @@ jobs: python -m pip install -U setuptools python -m pip install -U wheel python -m pip install -U pytest - python -m pip install "numpy==${{ matrix.numpy-version }}" + python -m pip install "numpy==${{ matrix.numpy-version }}.*" - name: Install run: | @@ -93,41 +66,14 @@ jobs: fail-fast: false matrix: os: [ ubuntu-latest ] - python-version: [ "3.10", "3.11", "3.12", "3.13", "3.14" ] - numpy-version: [ "1.24", "1.25", "1.26", "2.0", "2.1", "2.2", "2.3", "2.4" ] + python-version: [ "3.11", "3.12", "3.13", "3.14", "3.15" ] + numpy-version: [ "2.0", "2.1", "2.2", "2.3", "2.4", "2.5" ] exclude: - - python-version: "3.10" - numpy-version: "2.3" - os: ubuntu-latest - - python-version: "3.10" - numpy-version: "2.4" - os: ubuntu-latest - python-version: "3.11" numpy-version: "2.4" os: ubuntu-latest - - python-version: "3.12" - numpy-version: "1.24" - os: ubuntu-latest - - python-version: "3.12" - numpy-version: "1.25" - os: ubuntu-latest - - python-version: "3.13" - numpy-version: "1.24" - os: ubuntu-latest - - python-version: "3.13" - numpy-version: "1.25" - os: ubuntu-latest - - python-version: "3.13" - numpy-version: "1.26" - os: ubuntu-latest - - python-version: "3.14" - numpy-version: "1.24" - os: ubuntu-latest - - python-version: "3.14" - numpy-version: "1.25" - os: ubuntu-latest - - python-version: "3.14" - numpy-version: "1.26" + - python-version: "3.11" + numpy-version: "2.5" os: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -156,7 +102,7 @@ jobs: python -m pip install -U pip python -m pip install -U setuptools python -m pip install -U wheel - python -m pip install "numpy==${{ matrix.numpy-version }}" + python -m pip install "numpy==${{ matrix.numpy-version }}.*" python -m pip install -U pytest python -m pip install -U mypy diff --git a/CHANGES.txt b/CHANGES.txt index 73e05ed..745e308 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -8,6 +8,8 @@ Unreleased - Correct the pond force unit to 0.00980665 N (one gram-force); it was previously 1000 times too large (`#44 `_). +- Fix type checking with NumPy 2.5 +- Add CI testing for Python 3.15 and NumPy 2.5, drop support for Python 3.10 and for NumPy 1.x (following NEP 29 plus one year) ------ 0.16.4 diff --git a/doc/user/installation.rst b/doc/user/installation.rst index f3c40c9..5d6423d 100644 --- a/doc/user/installation.rst +++ b/doc/user/installation.rst @@ -8,8 +8,8 @@ Prerequisites Quantities has a few dependencies: -* Python_ (>=3.8) -* NumPy_ (>=1.19) +* Python_ (>=3.11) +* NumPy_ (>=2.0) (bearing in mind that not all combinations of Python and NumPy versions necessarily work). diff --git a/pyproject.toml b/pyproject.toml index 4fe21e6..96e5779 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ name = "quantities" description = "Support for physical quantities with units, based on numpy" readme = "README.rst" -requires-python = ">=3.10" +requires-python = ">=3.11" license-files = ["doc/user/license.rst"] authors = [ {name = "Darren Dale", email = "dsdale24@gmail.com"} @@ -24,7 +24,7 @@ classifiers = [ "Topic :: Scientific/Engineering" ] dependencies = [ - "numpy>=1.24" + "numpy>=2.0" ] dynamic = ["version"] @@ -58,7 +58,7 @@ write_to = "quantities/_version.py" [tool.ruff] line-length = 120 -target-version = "py310" +target-version = "py311" [tool.ruff.lint] # pycodestyle errors and warnings, pyflakes, isort. diff --git a/quantities/quantity.pyi b/quantities/quantity.pyi index 2d5db95..3e800a3 100644 --- a/quantities/quantity.pyi +++ b/quantities/quantity.pyi @@ -1,5 +1,6 @@ from typing import Any, Optional +import numpy as np import numpy.typing as npt from quantities.dimensionality import Dimensionality @@ -21,7 +22,7 @@ def scale_other_units(f: Any) -> None: ... -class Quantity(npt.NDArray): +class Quantity(np.ndarray[Any, np.dtype[Any]]): def __new__(cls, data: QuantityData, units: DimensionalityDescriptor = ..., dtype: Optional[object] = ..., copy: bool = ...) -> Quantity: