From 47c5db216576afe3577216f5f40acf42aca8edf1 Mon Sep 17 00:00:00 2001 From: David Zwicker Date: Wed, 4 Oct 2023 10:18:02 +0200 Subject: [PATCH 01/13] Bump allowed python version to 3.12 --- .github/workflows/tests_all.yml | 2 +- .github/workflows/tests_mpi.yml | 2 +- .github/workflows/tests_types.yml | 2 +- pyproject.toml | 3 ++- scripts/_templates/pyproject.toml | 1 + scripts/create_requirements.py | 4 ++-- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tests_all.yml b/.github/workflows/tests_all.yml index db7e3895..82161432 100644 --- a/.github/workflows/tests_all.yml +++ b/.github/workflows/tests_all.yml @@ -15,7 +15,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: '3.11' + python-version: '3.12' - name: Install dependencies # install all requirements diff --git a/.github/workflows/tests_mpi.yml b/.github/workflows/tests_mpi.yml index a535ce34..5b2c5bea 100644 --- a/.github/workflows/tests_mpi.yml +++ b/.github/workflows/tests_mpi.yml @@ -15,7 +15,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: '3.11' + python-version: '3.12' - uses: mpi4py/setup-mpi@v1 - name: Install dependencies diff --git a/.github/workflows/tests_types.yml b/.github/workflows/tests_types.yml index b2201b82..54befdf9 100644 --- a/.github/workflows/tests_types.yml +++ b/.github/workflows/tests_types.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - pyversion: ['3.8', '3.11'] + pyversion: ['3.8', '3.12'] timeout-minutes: 30 steps: diff --git a/pyproject.toml b/pyproject.toml index bde06a8d..f4aa0663 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ authors = [ ] license = {text = "MIT"} readme = "README.md" -requires-python = ">=3.8,<3.12" +requires-python = ">=3.8,<3.13" dynamic = ["version"] keywords = ["pdes", "partial-differential-equations", "dynamical-systems"] @@ -24,6 +24,7 @@ classifiers = [ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", ] # Requirements for setuptools diff --git a/scripts/_templates/pyproject.toml b/scripts/_templates/pyproject.toml index 31666426..1c51235b 100644 --- a/scripts/_templates/pyproject.toml +++ b/scripts/_templates/pyproject.toml @@ -21,6 +21,7 @@ classifiers = [ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", ] # Requirements for setuptools diff --git a/scripts/create_requirements.py b/scripts/create_requirements.py index b1b590dc..66f878ea 100755 --- a/scripts/create_requirements.py +++ b/scripts/create_requirements.py @@ -12,7 +12,7 @@ PACKAGE_PATH = Path(__file__).resolve().parents[1] MIN_PYTHON_VERSION = "3.8" -MAX_PYTHON_VERSION = "3.11" +MAX_PYTHON_VERSION = "3.12" @dataclass @@ -213,7 +213,7 @@ def write_requirements_csv( with open(path, "w") as fp: writer = csv.writer(fp) if incl_version: - writer.writerow(["Package", "Minimal version_min", "Usage"]) + writer.writerow(["Package", "Minimal version", "Usage"]) else: writer.writerow(["Package", "Usage"]) for r in sorted(requirements, key=lambda r: r.name.lower()): From e4c7c4d91b85dead7f6a610a53ecff55a3008e96 Mon Sep 17 00:00:00 2001 From: David Zwicker Date: Fri, 2 Feb 2024 14:19:49 +0100 Subject: [PATCH 02/13] Updated requirements for near numba release --- docs/source/_static/requirements_main.csv | 2 +- pde/tools/resources/requirements_basic.txt | 10 +++++----- pde/tools/resources/requirements_full.txt | 10 +++++----- pde/tools/resources/requirements_mpi.txt | 10 +++++----- pyproject.toml | 2 +- requirements.txt | 10 +++++----- scripts/create_requirements.py | 10 +++++----- tests/requirements_full.txt | 10 +++++----- tests/requirements_min.txt | 10 +++++----- tests/requirements_mpi.txt | 10 +++++----- 10 files changed, 42 insertions(+), 42 deletions(-) diff --git a/docs/source/_static/requirements_main.csv b/docs/source/_static/requirements_main.csv index a81093ac..9b72f6f8 100644 --- a/docs/source/_static/requirements_main.csv +++ b/docs/source/_static/requirements_main.csv @@ -1,6 +1,6 @@ Package,Minimal version,Usage matplotlib,3.1,Visualizing results -numba,0.56,Just-in-time compilation to accelerate numerics +numba,0.59,Just-in-time compilation to accelerate numerics numpy,1.22,Handling numerical data scipy,1.10,Miscellaneous scientific functions sympy,1.9,Dealing with user-defined mathematical expressions diff --git a/pde/tools/resources/requirements_basic.txt b/pde/tools/resources/requirements_basic.txt index 68d9352d..44a2810c 100644 --- a/pde/tools/resources/requirements_basic.txt +++ b/pde/tools/resources/requirements_basic.txt @@ -1,7 +1,7 @@ # These are the basic requirements for the package -matplotlib>=3.1.0 -numba>=0.56.0 -numpy>=1.22.0 -scipy>=1.10.0 -sympy>=1.9.0 +matplotlib>=3.1 +numba>=0.59 +numpy>=1.22 +scipy>=1.10 +sympy>=1.9 tqdm>=4.60 diff --git a/pde/tools/resources/requirements_full.txt b/pde/tools/resources/requirements_full.txt index f36f9efe..312979ee 100644 --- a/pde/tools/resources/requirements_full.txt +++ b/pde/tools/resources/requirements_full.txt @@ -1,11 +1,11 @@ # These are the full requirements used to test all functions h5py>=2.10 -matplotlib>=3.1.0 -numba>=0.56.0 -numpy>=1.22.0 +matplotlib>=3.1 +numba>=0.59 +numpy>=1.22 pandas>=1.2 pyfftw>=0.12 rocket-fft>=0.2 -scipy>=1.10.0 -sympy>=1.9.0 +scipy>=1.10 +sympy>=1.9 tqdm>=4.60 diff --git a/pde/tools/resources/requirements_mpi.txt b/pde/tools/resources/requirements_mpi.txt index 5b45dab3..e2949a02 100644 --- a/pde/tools/resources/requirements_mpi.txt +++ b/pde/tools/resources/requirements_mpi.txt @@ -1,11 +1,11 @@ # These are requirements for supporting multiprocessing h5py>=2.10 -matplotlib>=3.1.0 +matplotlib>=3.1 mpi4py>=3 -numba>=0.56.0 +numba>=0.59 numba-mpi>=0.22 -numpy>=1.22.0 +numpy>=1.22 pandas>=1.2 -scipy>=1.10.0 -sympy>=1.9.0 +scipy>=1.10 +sympy>=1.9 tqdm>=4.60 diff --git a/pyproject.toml b/pyproject.toml index f4aa0663..85e75904 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,7 +28,7 @@ classifiers = [ ] # Requirements for setuptools -dependencies = ["matplotlib>=3.1.0", "numba>=0.56.0", "numpy>=1.22.0", "scipy>=1.10.0", "sympy>=1.9.0", "tqdm>=4.60"] +dependencies = ["matplotlib>=3.1", "numba>=0.59", "numpy>=1.22", "scipy>=1.10", "sympy>=1.9", "tqdm>=4.60"] [project.optional-dependencies] hdf = ["h5py>=2.10"] diff --git a/requirements.txt b/requirements.txt index 8421e205..43094407 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ -matplotlib>=3.1.0 -numba>=0.56.0 -numpy>=1.22.0 -scipy>=1.10.0 -sympy>=1.9.0 +matplotlib>=3.1 +numba>=0.59 +numpy>=1.22 +scipy>=1.10 +sympy>=1.9 tqdm>=4.60 diff --git a/scripts/create_requirements.py b/scripts/create_requirements.py index d90dfbb9..adb66199 100755 --- a/scripts/create_requirements.py +++ b/scripts/create_requirements.py @@ -59,31 +59,31 @@ def line(self, relation: str = ">=") -> str: # essential requirements Requirement( name="matplotlib", - version_min="3.1.0", + version_min="3.1", usage="Visualizing results", essential=True, ), Requirement( name="numba", - version_min="0.56.0", + version_min="0.59", usage="Just-in-time compilation to accelerate numerics", essential=True, ), Requirement( name="numpy", - version_min="1.22.0", + version_min="1.22", usage="Handling numerical data", essential=True, ), Requirement( name="scipy", - version_min="1.10.0", + version_min="1.10", usage="Miscellaneous scientific functions", essential=True, ), Requirement( name="sympy", - version_min="1.9.0", + version_min="1.9", usage="Dealing with user-defined mathematical expressions", essential=True, ), diff --git a/tests/requirements_full.txt b/tests/requirements_full.txt index f36f9efe..312979ee 100644 --- a/tests/requirements_full.txt +++ b/tests/requirements_full.txt @@ -1,11 +1,11 @@ # These are the full requirements used to test all functions h5py>=2.10 -matplotlib>=3.1.0 -numba>=0.56.0 -numpy>=1.22.0 +matplotlib>=3.1 +numba>=0.59 +numpy>=1.22 pandas>=1.2 pyfftw>=0.12 rocket-fft>=0.2 -scipy>=1.10.0 -sympy>=1.9.0 +scipy>=1.10 +sympy>=1.9 tqdm>=4.60 diff --git a/tests/requirements_min.txt b/tests/requirements_min.txt index a411b8c9..5c1ea48d 100644 --- a/tests/requirements_min.txt +++ b/tests/requirements_min.txt @@ -1,7 +1,7 @@ # These are the minimal requirements used to test compatibility -matplotlib~=3.1.0 -numba~=0.56.0 -numpy~=1.22.0 -scipy~=1.10.0 -sympy~=1.9.0 +matplotlib~=3.1 +numba~=0.59 +numpy~=1.22 +scipy~=1.10 +sympy~=1.9 tqdm~=4.60 diff --git a/tests/requirements_mpi.txt b/tests/requirements_mpi.txt index a29101f8..3a3b9eda 100644 --- a/tests/requirements_mpi.txt +++ b/tests/requirements_mpi.txt @@ -1,11 +1,11 @@ # These are requirements used to test multiprocessing h5py>=2.10 -matplotlib>=3.1.0 +matplotlib>=3.1 mpi4py>=3 -numba>=0.56.0 +numba>=0.59 numba-mpi>=0.22 -numpy>=1.22.0 +numpy>=1.22 pandas>=1.2 -scipy>=1.10.0 -sympy>=1.9.0 +scipy>=1.10 +sympy>=1.9 tqdm>=4.60 From d88eb604ac939545d6fbbbedfe104b9cc461a428 Mon Sep 17 00:00:00 2001 From: David Zwicker Date: Fri, 2 Feb 2024 14:33:53 +0100 Subject: [PATCH 03/13] Raised minimal python version to 3.9 --- .github/workflows/release_pip.yml | 2 +- .github/workflows/tests_minversion.yml | 2 +- .github/workflows/tests_types.yml | 2 +- pde/fields/base.py | 2 +- pde/fields/collection.py | 4 ++-- pde/fields/scalar.py | 3 ++- pde/fields/tensorial.py | 3 ++- pde/fields/vectorial.py | 3 ++- pde/grids/_mesh.py | 3 ++- pde/grids/base.py | 13 ++----------- pde/grids/boundaries/axes.py | 3 ++- pde/grids/boundaries/axis.py | 6 +++--- pde/grids/boundaries/local.py | 6 +++--- pde/grids/cartesian.py | 3 ++- pde/grids/cylindrical.py | 3 ++- pde/solvers/__init__.py | 2 +- pde/solvers/controller.py | 4 ++-- pde/storage/base.py | 3 ++- pde/storage/memory.py | 2 +- pde/tools/cache.py | 3 ++- pde/tools/expressions.py | 3 ++- pde/tools/misc.py | 3 ++- pde/tools/parameters.py | 3 ++- pde/tools/plotting.py | 3 ++- pde/tools/spectral.py | 8 +++++--- pde/trackers/base.py | 5 +++-- pde/trackers/interrupts.py | 5 +++-- pde/visualization/plotting.py | 2 +- pyproject.toml | 7 +++---- runtime.txt | 2 +- scripts/_templates/pyproject.toml | 1 - scripts/create_requirements.py | 17 +++++++++-------- scripts/format_code.sh | 2 +- scripts/run_tests.py | 2 +- tests/test_examples.py | 2 +- 35 files changed, 72 insertions(+), 65 deletions(-) diff --git a/.github/workflows/release_pip.yml b/.github/workflows/release_pip.yml index c06181c1..c08f6898 100644 --- a/.github/workflows/release_pip.yml +++ b/.github/workflows/release_pip.yml @@ -17,7 +17,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: '3.8' + python-version: '3.9' - name: Install dependencies run: | diff --git a/.github/workflows/tests_minversion.yml b/.github/workflows/tests_minversion.yml index a63734b8..8bfc7c8a 100644 --- a/.github/workflows/tests_minversion.yml +++ b/.github/workflows/tests_minversion.yml @@ -15,7 +15,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: '3.8' + python-version: '3.9' - name: Install dependencies # install packages in the exact version given in requirements.txt diff --git a/.github/workflows/tests_types.yml b/.github/workflows/tests_types.yml index 54befdf9..d255a7cb 100644 --- a/.github/workflows/tests_types.yml +++ b/.github/workflows/tests_types.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - pyversion: ['3.8', '3.12'] + pyversion: ['3.9', '3.12'] timeout-minutes: 30 steps: diff --git a/pde/fields/base.py b/pde/fields/base.py index cf2d0e66..3b105e3d 100644 --- a/pde/fields/base.py +++ b/pde/fields/base.py @@ -155,7 +155,7 @@ def _data_flat(self) -> np.ndarray: # flatten the first dimension of the internal data by creating a view and then # setting the new shape. This disallows accidental copying of the data data_flat = self._data_full.view() - data_flat.shape = (-1, *self.grid._shape_full) # type: ignore + data_flat.shape = (-1, *self.grid._shape_full) return data_flat @_data_flat.setter diff --git a/pde/fields/collection.py b/pde/fields/collection.py index a3bb27ff..22584a9a 100644 --- a/pde/fields/collection.py +++ b/pde/fields/collection.py @@ -9,7 +9,8 @@ import json import logging import warnings -from typing import Any, Callable, Iterator, Literal, Mapping, Sequence, overload +from collections.abc import Iterator, Mapping, Sequence +from typing import Any, Callable, Literal, overload import numpy as np from matplotlib import cm @@ -21,7 +22,6 @@ except ImportError: from matplotlib.cm import get_cmap - from ..grids.base import GridBase from ..tools.docstrings import fill_in_docstring from ..tools.misc import Number, number_array diff --git a/pde/fields/scalar.py b/pde/fields/scalar.py index 2c1421b9..c974f01d 100644 --- a/pde/fields/scalar.py +++ b/pde/fields/scalar.py @@ -7,8 +7,9 @@ from __future__ import annotations import numbers +from collections.abc import Sequence from pathlib import Path -from typing import TYPE_CHECKING, Callable, Literal, Sequence +from typing import TYPE_CHECKING, Callable, Literal import numpy as np from numpy.typing import DTypeLike diff --git a/pde/fields/tensorial.py b/pde/fields/tensorial.py index 42f420d0..9fb16d2d 100644 --- a/pde/fields/tensorial.py +++ b/pde/fields/tensorial.py @@ -6,7 +6,8 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Callable, Sequence +from collections.abc import Sequence +from typing import TYPE_CHECKING, Callable import numpy as np from numpy.typing import DTypeLike diff --git a/pde/fields/vectorial.py b/pde/fields/vectorial.py index 7b7ecfb7..e505d33e 100644 --- a/pde/fields/vectorial.py +++ b/pde/fields/vectorial.py @@ -6,7 +6,8 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Callable, Literal, Sequence +from collections.abc import Sequence +from typing import TYPE_CHECKING, Any, Callable, Literal import numba as nb import numpy as np diff --git a/pde/grids/_mesh.py b/pde/grids/_mesh.py index 659821aa..2a6fb3e0 100644 --- a/pde/grids/_mesh.py +++ b/pde/grids/_mesh.py @@ -7,8 +7,9 @@ from __future__ import annotations import math +from collections.abc import Sequence from enum import IntEnum -from typing import Any, Sequence, TypeVar +from typing import Any, TypeVar import numpy as np diff --git a/pde/grids/base.py b/pde/grids/base.py index f78a5797..9f8cd0ba 100644 --- a/pde/grids/base.py +++ b/pde/grids/base.py @@ -14,17 +14,8 @@ import math import warnings from abc import ABCMeta, abstractmethod -from typing import ( - TYPE_CHECKING, - Any, - Callable, - Generator, - Iterator, - Literal, - NamedTuple, - Sequence, - overload, -) +from collections.abc import Generator, Iterator, Sequence +from typing import TYPE_CHECKING, Any, Callable, Literal, NamedTuple, overload import numba as nb import numpy as np diff --git a/pde/grids/boundaries/axes.py b/pde/grids/boundaries/axes.py index f2a87aa0..ece24be5 100644 --- a/pde/grids/boundaries/axes.py +++ b/pde/grids/boundaries/axes.py @@ -8,7 +8,8 @@ from __future__ import annotations -from typing import Sequence, Union +from collections.abc import Sequence +from typing import Union import numpy as np from numba.extending import register_jitable diff --git a/pde/grids/boundaries/axis.py b/pde/grids/boundaries/axis.py index d4e8974a..1d7d36ab 100644 --- a/pde/grids/boundaries/axis.py +++ b/pde/grids/boundaries/axis.py @@ -11,7 +11,7 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Dict, Tuple, Union +from typing import TYPE_CHECKING, Union import numpy as np from numba.extending import register_jitable @@ -24,9 +24,9 @@ from .._mesh import GridMesh BoundaryPairData = Union[ - Dict[str, BoundaryData], + dict[str, BoundaryData], BoundaryData, - Tuple[BoundaryData, BoundaryData], + tuple[BoundaryData, BoundaryData], "BoundaryAxisBase", ] diff --git a/pde/grids/boundaries/local.py b/pde/grids/boundaries/local.py index 1420bf01..dba86f11 100644 --- a/pde/grids/boundaries/local.py +++ b/pde/grids/boundaries/local.py @@ -65,7 +65,7 @@ import warnings from abc import ABCMeta, abstractmethod from numbers import Number -from typing import TYPE_CHECKING, Any, Callable, Dict, Literal, Tuple, TypeVar, Union +from typing import TYPE_CHECKING, Any, Callable, Literal, TypeVar, Union import numba as nb import numpy as np @@ -86,7 +86,7 @@ from .._mesh import GridMesh -BoundaryData = Union[Dict, str, "BCBase"] +BoundaryData = Union[dict, str, "BCBase"] class BCDataError(ValueError): @@ -166,7 +166,7 @@ def _make_get_arr_1d( Consequently, `i = idx[axis]` and `arr[..., idx] == arr_1d[..., i]`. """ assert 0 <= axis < dim - ResultType = Tuple[np.ndarray, int, Tuple] + ResultType = tuple[np.ndarray, int, tuple] # extract the correct indices if dim == 1: diff --git a/pde/grids/cartesian.py b/pde/grids/cartesian.py index ff19ac86..65528f90 100644 --- a/pde/grids/cartesian.py +++ b/pde/grids/cartesian.py @@ -7,7 +7,8 @@ from __future__ import annotations import itertools -from typing import TYPE_CHECKING, Any, Generator, Sequence +from collections.abc import Generator, Sequence +from typing import TYPE_CHECKING, Any import numpy as np diff --git a/pde/grids/cylindrical.py b/pde/grids/cylindrical.py index f9f6de12..296b3b9b 100644 --- a/pde/grids/cylindrical.py +++ b/pde/grids/cylindrical.py @@ -6,7 +6,8 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Any, Generator, Literal, Sequence +from collections.abc import Generator, Sequence +from typing import TYPE_CHECKING, Any, Literal import numpy as np diff --git a/pde/solvers/__init__.py b/pde/solvers/__init__.py index 7b235a0d..be12029a 100644 --- a/pde/solvers/__init__.py +++ b/pde/solvers/__init__.py @@ -30,7 +30,7 @@ ExplicitMPISolver = None # type: ignore -def registered_solvers() -> List[str]: +def registered_solvers() -> list[str]: """returns all solvers that are currently registered Returns: diff --git a/pde/solvers/controller.py b/pde/solvers/controller.py index 25533100..1f273b9f 100644 --- a/pde/solvers/controller.py +++ b/pde/solvers/controller.py @@ -9,7 +9,7 @@ import datetime import logging import time -from typing import TYPE_CHECKING, Any, Callable, Tuple, TypeVar, Union +from typing import TYPE_CHECKING, Any, Callable, TypeVar, Union from .. import __version__ from ..tools import mpi @@ -25,7 +25,7 @@ from ..fields.base import FieldBase -TRangeType = Union[float, Tuple[float, float]] +TRangeType = Union[float, tuple[float, float]] TState = TypeVar("TState", bound="FieldBase") diff --git a/pde/storage/base.py b/pde/storage/base.py index d1355695..94d3b856 100644 --- a/pde/storage/base.py +++ b/pde/storage/base.py @@ -8,8 +8,9 @@ import logging from abc import ABCMeta, abstractmethod +from collections.abc import Iterator, Sequence from inspect import signature -from typing import TYPE_CHECKING, Any, Callable, Iterator, Literal, Sequence +from typing import TYPE_CHECKING, Any, Callable, Literal import numpy as np from numpy.typing import DTypeLike diff --git a/pde/storage/memory.py b/pde/storage/memory.py index 2916b262..8ab95857 100644 --- a/pde/storage/memory.py +++ b/pde/storage/memory.py @@ -6,8 +6,8 @@ from __future__ import annotations +from collections.abc import Sequence from contextlib import contextmanager -from typing import Sequence import numpy as np diff --git a/pde/tools/cache.py b/pde/tools/cache.py index b95920e1..3a23a6c9 100644 --- a/pde/tools/cache.py +++ b/pde/tools/cache.py @@ -22,8 +22,9 @@ import functools import logging import numbers +from collections.abc import Iterable from hashlib import sha1 -from typing import Callable, Iterable, Literal, TypeVar +from typing import Callable, Literal, TypeVar import numpy as np from scipy import sparse diff --git a/pde/tools/expressions.py b/pde/tools/expressions.py index da1b1fc1..91beff2d 100644 --- a/pde/tools/expressions.py +++ b/pde/tools/expressions.py @@ -25,7 +25,8 @@ import numbers import re from abc import ABCMeta, abstractmethod -from typing import Any, Callable, Mapping, Sequence, Union +from collections.abc import Mapping, Sequence +from typing import Any, Callable, Union import numpy as np import sympy diff --git a/pde/tools/misc.py b/pde/tools/misc.py index d6ab45a4..3c7935c1 100644 --- a/pde/tools/misc.py +++ b/pde/tools/misc.py @@ -29,8 +29,9 @@ import os import unittest import warnings +from collections.abc import Sequence from pathlib import Path -from typing import Any, Callable, Sequence, TypeVar +from typing import Any, Callable, TypeVar import numpy as np from numpy.typing import DTypeLike diff --git a/pde/tools/parameters.py b/pde/tools/parameters.py index 8edb29bf..958d2197 100644 --- a/pde/tools/parameters.py +++ b/pde/tools/parameters.py @@ -19,7 +19,8 @@ import logging import warnings -from typing import Any, Sequence, Union +from collections.abc import Sequence +from typing import Any, Union import numpy as np diff --git a/pde/tools/plotting.py b/pde/tools/plotting.py index b8ba0514..bed61d57 100644 --- a/pde/tools/plotting.py +++ b/pde/tools/plotting.py @@ -24,7 +24,8 @@ import logging import sys import warnings -from typing import TYPE_CHECKING, Any, Generator, Literal +from collections.abc import Generator +from typing import TYPE_CHECKING, Any, Literal from ..tools.docstrings import replace_in_docstring diff --git a/pde/tools/spectral.py b/pde/tools/spectral.py index 8fd84c4e..0761be79 100644 --- a/pde/tools/spectral.py +++ b/pde/tools/spectral.py @@ -9,7 +9,9 @@ .. codeauthor:: David Zwicker """ -from typing import Callable, Optional, Tuple +from __future__ import annotations + +from typing import Callable, Optional import numpy as np @@ -22,11 +24,11 @@ def make_colored_noise( - shape: Tuple[int, ...], + shape: tuple[int, ...], dx=1.0, exponent: float = 0, scale: float = 1, - rng: Optional[np.random.Generator] = None, + rng: np.random.Generator | None = None, ) -> Callable[[], np.ndarray]: r"""Return a function creating an array of random values that obey diff --git a/pde/trackers/base.py b/pde/trackers/base.py index 83a9bd97..58cd65c8 100644 --- a/pde/trackers/base.py +++ b/pde/trackers/base.py @@ -10,7 +10,8 @@ import math import warnings from abc import ABCMeta, abstractmethod -from typing import Any, Dict, Optional, Sequence, Union +from collections.abc import Sequence +from typing import Any, Optional, Union import numpy as np @@ -19,7 +20,7 @@ from ..tools.misc import module_available from .interrupts import InterruptData, parse_interrupt -InfoDict = Optional[Dict[str, Any]] +InfoDict = Optional[dict[str, Any]] TrackerDataType = Union["TrackerBase", str] diff --git a/pde/trackers/interrupts.py b/pde/trackers/interrupts.py index 7a98cb57..de516590 100644 --- a/pde/trackers/interrupts.py +++ b/pde/trackers/interrupts.py @@ -20,13 +20,14 @@ import math import time from abc import ABCMeta, abstractmethod -from typing import Any, Dict, Optional, Sequence, TypeVar, Union +from collections.abc import Sequence +from typing import Any, Optional, TypeVar, Union import numpy as np from ..tools.parse_duration import parse_duration -InfoDict = Optional[Dict[str, Any]] +InfoDict = Optional[dict[str, Any]] TInterrupt = TypeVar("TInterrupt", bound="InterruptsBase") diff --git a/pde/visualization/plotting.py b/pde/visualization/plotting.py index 44250aa6..3e8a92df 100644 --- a/pde/visualization/plotting.py +++ b/pde/visualization/plotting.py @@ -38,7 +38,7 @@ ) _logger = logging.getLogger(__name__) -ScaleData = Union[str, float, Tuple[float, float]] +ScaleData = Union[str, float, tuple[float, float]] def _add_horizontal_colorbar(im, ax, num_loc: int = 5) -> None: diff --git a/pyproject.toml b/pyproject.toml index 85e75904..a1b8b6c5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ authors = [ ] license = {text = "MIT"} readme = "README.md" -requires-python = ">=3.8,<3.13" +requires-python = ">=3.9,<3.13" dynamic = ["version"] keywords = ["pdes", "partial-differential-equations", "dynamical-systems"] @@ -20,7 +20,6 @@ classifiers = [ "Topic :: Scientific/Engineering", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -60,7 +59,7 @@ namespaces = false write_to = "pde/_version.py" [tool.black] -target_version = ["py38"] +target_version = ["py39"] exclude = "scripts/templates" [tool.isort] @@ -78,7 +77,7 @@ filterwarnings = [ ] [tool.mypy] -python_version = "3.8" +python_version = "3.9" plugins = "numpy.typing.mypy_plugin" warn_return_any = true warn_unused_configs = true diff --git a/runtime.txt b/runtime.txt index 3cd31022..032aea2d 100644 --- a/runtime.txt +++ b/runtime.txt @@ -1 +1 @@ -python-3.8 \ No newline at end of file +python-3.9 \ No newline at end of file diff --git a/scripts/_templates/pyproject.toml b/scripts/_templates/pyproject.toml index 1c51235b..ef572028 100644 --- a/scripts/_templates/pyproject.toml +++ b/scripts/_templates/pyproject.toml @@ -17,7 +17,6 @@ classifiers = [ "Topic :: Scientific/Engineering", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", diff --git a/scripts/create_requirements.py b/scripts/create_requirements.py index adb66199..ccb379d5 100755 --- a/scripts/create_requirements.py +++ b/scripts/create_requirements.py @@ -3,15 +3,16 @@ This script creates the requirements files in the project """ +from __future__ import annotations + import csv import subprocess as sp from dataclasses import dataclass, field from pathlib import Path from string import Template -from typing import List, Optional, Set PACKAGE_PATH = Path(__file__).resolve().parents[1] -MIN_PYTHON_VERSION = "3.8" +MIN_PYTHON_VERSION = "3.9" MAX_PYTHON_VERSION = "3.12" @@ -22,11 +23,11 @@ class Requirement: name: str # name of the python package version_min: str # minimal version usage: str = "" # description for how the package is used in py-pde - relation: Optional[str] = None # relation used to compare version number + relation: str | None = None # relation used to compare version number essential: bool = False # basic requirement for the package docs_only: bool = False # only required for creating documentation tests_only: bool = False # only required for running tests - collections: Set[str] = field(default_factory=set) # collections where this fits + collections: set[str] = field(default_factory=set) # collections where this fits @property def short_version(self) -> str: @@ -172,7 +173,7 @@ def line(self, relation: str = ">=") -> str: def write_requirements_txt( path: Path, - requirements: List[Requirement], + requirements: list[Requirement], *, relation: str = ">=", ref_base: bool = False, @@ -201,7 +202,7 @@ def write_requirements_txt( def write_requirements_csv( - path: Path, requirements: List[Requirement], *, incl_version: bool = True + path: Path, requirements: list[Requirement], *, incl_version: bool = True ): """write requirements to a CSV file @@ -223,7 +224,7 @@ def write_requirements_csv( writer.writerow([r.name, r.usage]) -def write_requirements_py(path: Path, requirements: List[Requirement]): +def write_requirements_py(path: Path, requirements: list[Requirement]): """write requirements check into a python module Args: @@ -257,7 +258,7 @@ def write_from_template( path: Path, template_name: str, *, - requirements: Optional[List[Requirement]] = None, + requirements: list[Requirement] | None = None, fix_format: bool = False, add_warning: bool = True, ): diff --git a/scripts/format_code.sh b/scripts/format_code.sh index 2d8651aa..2366dc0b 100755 --- a/scripts/format_code.sh +++ b/scripts/format_code.sh @@ -3,7 +3,7 @@ echo "Upgrading python syntax..." pushd .. > /dev/null -find . -name '*.py' -exec pyupgrade --py38-plus {} + +find . -name '*.py' -exec pyupgrade --py39-plus {} + popd > /dev/null echo "Formating import statements..." diff --git a/scripts/run_tests.py b/scripts/run_tests.py index 259a2ced..a45f55c1 100755 --- a/scripts/run_tests.py +++ b/scripts/run_tests.py @@ -6,8 +6,8 @@ import os import subprocess as sp import sys +from collections.abc import Sequence from pathlib import Path -from typing import Sequence PACKAGE = "pde" # name of the package that needs to be tested PACKAGE_PATH = Path(__file__).resolve().parents[1] # base path of the package diff --git a/tests/test_examples.py b/tests/test_examples.py index 6bfd5c9f..21dc2dc7 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -17,7 +17,7 @@ EXAMPLES = (PACKAGE_PATH / "examples").glob("*.py") NOTEBOOKS = (PACKAGE_PATH / "examples").glob("*/*.ipynb") -SKIP_EXAMPLES: List[str] = [] +SKIP_EXAMPLES: list[str] = [] if not Movie.is_available(): SKIP_EXAMPLES.extend(["make_movie_live.py", "make_movie_storage.py"]) if not module_available("mpi4py"): From 9c3cd1ccd61676dfd363d7cd266943817df436ae Mon Sep 17 00:00:00 2001 From: David Zwicker Date: Mon, 5 Feb 2024 11:18:54 +0100 Subject: [PATCH 04/13] Updated readthedocs config to use newer python --- .readthedocs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 470ec688..bc10fcea 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -9,7 +9,7 @@ version: 2 build: os: ubuntu-22.04 tools: - python: "3.8" + python: "3.11" apt_packages: - graphviz From 1fb28b318fcfd180b7bfd05d261bc2699e6bf585 Mon Sep 17 00:00:00 2001 From: David Zwicker Date: Mon, 5 Feb 2024 11:51:31 +0100 Subject: [PATCH 05/13] Bumped some requirements --- docs/source/_static/requirements_main.csv | 2 +- docs/source/_static/requirements_optional.csv | 2 +- pde/tools/resources/requirements_basic.txt | 2 +- pde/tools/resources/requirements_full.txt | 2 +- pde/tools/resources/requirements_mpi.txt | 2 +- pyproject.toml | 4 ++-- requirements.txt | 2 +- scripts/create_requirements.py | 6 +++--- tests/requirements.txt | 2 +- tests/requirements_full.txt | 2 +- tests/requirements_min.txt | 2 +- tests/requirements_mpi.txt | 2 +- 12 files changed, 15 insertions(+), 15 deletions(-) diff --git a/docs/source/_static/requirements_main.csv b/docs/source/_static/requirements_main.csv index 9b72f6f8..ed965a7d 100644 --- a/docs/source/_static/requirements_main.csv +++ b/docs/source/_static/requirements_main.csv @@ -4,4 +4,4 @@ numba,0.59,Just-in-time compilation to accelerate numerics numpy,1.22,Handling numerical data scipy,1.10,Miscellaneous scientific functions sympy,1.9,Dealing with user-defined mathematical expressions -tqdm,4.60,Display progress bars during calculations +tqdm,4.66,Display progress bars during calculations diff --git a/docs/source/_static/requirements_optional.csv b/docs/source/_static/requirements_optional.csv index abbb100d..db82a40e 100644 --- a/docs/source/_static/requirements_optional.csv +++ b/docs/source/_static/requirements_optional.csv @@ -1,6 +1,6 @@ Package,Minimal version,Usage h5py,2.10,Storing data in the hierarchical file format -ipywidgets,7,Jupyter notebook support +ipywidgets,8,Jupyter notebook support mpi4py,3,Parallel processing using MPI napari,0.4.8,Displaying images interactively numba-mpi,0.22,Parallel processing using MPI+numba diff --git a/pde/tools/resources/requirements_basic.txt b/pde/tools/resources/requirements_basic.txt index 44a2810c..9d406830 100644 --- a/pde/tools/resources/requirements_basic.txt +++ b/pde/tools/resources/requirements_basic.txt @@ -4,4 +4,4 @@ numba>=0.59 numpy>=1.22 scipy>=1.10 sympy>=1.9 -tqdm>=4.60 +tqdm>=4.66 diff --git a/pde/tools/resources/requirements_full.txt b/pde/tools/resources/requirements_full.txt index 312979ee..dcb45097 100644 --- a/pde/tools/resources/requirements_full.txt +++ b/pde/tools/resources/requirements_full.txt @@ -8,4 +8,4 @@ pyfftw>=0.12 rocket-fft>=0.2 scipy>=1.10 sympy>=1.9 -tqdm>=4.60 +tqdm>=4.66 diff --git a/pde/tools/resources/requirements_mpi.txt b/pde/tools/resources/requirements_mpi.txt index e2949a02..c8855bae 100644 --- a/pde/tools/resources/requirements_mpi.txt +++ b/pde/tools/resources/requirements_mpi.txt @@ -8,4 +8,4 @@ numpy>=1.22 pandas>=1.2 scipy>=1.10 sympy>=1.9 -tqdm>=4.60 +tqdm>=4.66 diff --git a/pyproject.toml b/pyproject.toml index a1b8b6c5..1b5b1498 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,12 +27,12 @@ classifiers = [ ] # Requirements for setuptools -dependencies = ["matplotlib>=3.1", "numba>=0.59", "numpy>=1.22", "scipy>=1.10", "sympy>=1.9", "tqdm>=4.60"] +dependencies = ["matplotlib>=3.1", "numba>=0.59", "numpy>=1.22", "scipy>=1.10", "sympy>=1.9", "tqdm>=4.66"] [project.optional-dependencies] hdf = ["h5py>=2.10"] io = ["h5py>=2.10", "pandas>=1.2"] -interactive = ["napari>=0.4.8", "ipywidgets>=7"] +interactive = ["napari>=0.4.8", "ipywidgets>=8"] mpi = ["numba-mpi>=0.22", "mpi4py>=3"] [project.urls] diff --git a/requirements.txt b/requirements.txt index 43094407..a043079f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,4 +3,4 @@ numba>=0.59 numpy>=1.22 scipy>=1.10 sympy>=1.9 -tqdm>=4.60 +tqdm>=4.66 diff --git a/scripts/create_requirements.py b/scripts/create_requirements.py index ccb379d5..3d73ca2c 100755 --- a/scripts/create_requirements.py +++ b/scripts/create_requirements.py @@ -90,7 +90,7 @@ def line(self, relation: str = ">=") -> str: ), Requirement( name="tqdm", - version_min="4.60", + version_min="4.66", usage="Display progress bars during calculations", essential=True, ), @@ -121,7 +121,7 @@ def line(self, relation: str = ">=") -> str: ), Requirement( name="ipywidgets", - version_min="7", + version_min="8", usage="Jupyter notebook support", collections={"interactive"}, ), @@ -157,7 +157,7 @@ def line(self, relation: str = ">=") -> str: Requirement(name="importlib-metadata", version_min="5", tests_only=True), Requirement(name="isort", version_min="5.1", tests_only=True), Requirement(name="mypy", version_min="0.770", tests_only=True), - Requirement(name="notebook", version_min="6.5", relation="~=", tests_only=True), + Requirement(name="notebook", version_min="7", relation="~=", tests_only=True), Requirement(name="pyupgrade", version_min="3", tests_only=True), Requirement(name="pytest", version_min="5.4", tests_only=True), Requirement(name="pytest-cov", version_min="2.8", tests_only=True), diff --git a/tests/requirements.txt b/tests/requirements.txt index 314c2b9d..876b8da9 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -4,7 +4,7 @@ importlib-metadata>=5 isort>=5.1 jupyter_contrib_nbextensions>=0.5 mypy>=0.770 -notebook~=6.5 +notebook~=7 pytest>=5.4 pytest-cov>=2.8 pytest-xdist>=1.30 diff --git a/tests/requirements_full.txt b/tests/requirements_full.txt index 312979ee..dcb45097 100644 --- a/tests/requirements_full.txt +++ b/tests/requirements_full.txt @@ -8,4 +8,4 @@ pyfftw>=0.12 rocket-fft>=0.2 scipy>=1.10 sympy>=1.9 -tqdm>=4.60 +tqdm>=4.66 diff --git a/tests/requirements_min.txt b/tests/requirements_min.txt index 5c1ea48d..fde8f671 100644 --- a/tests/requirements_min.txt +++ b/tests/requirements_min.txt @@ -4,4 +4,4 @@ numba~=0.59 numpy~=1.22 scipy~=1.10 sympy~=1.9 -tqdm~=4.60 +tqdm~=4.66 diff --git a/tests/requirements_mpi.txt b/tests/requirements_mpi.txt index 3a3b9eda..3be9e6bc 100644 --- a/tests/requirements_mpi.txt +++ b/tests/requirements_mpi.txt @@ -8,4 +8,4 @@ numpy>=1.22 pandas>=1.2 scipy>=1.10 sympy>=1.9 -tqdm>=4.60 +tqdm>=4.66 From e2fba5807b4b5ca45191b711289269dae556f0f8 Mon Sep 17 00:00:00 2001 From: David Zwicker Date: Mon, 5 Feb 2024 11:56:04 +0100 Subject: [PATCH 06/13] Bumped some more requirements --- docs/requirements.txt | 2 +- docs/source/_static/requirements_optional.csv | 2 +- pde/tools/resources/requirements_full.txt | 2 +- pde/tools/resources/requirements_mpi.txt | 2 +- pyproject.toml | 2 +- scripts/create_requirements.py | 6 +++--- tests/requirements.txt | 4 ++-- tests/requirements_full.txt | 2 +- tests/requirements_mpi.txt | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index 53c4341d..139bed0a 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,6 +1,6 @@ -r ../requirements.txt h5py>=2.10 -pandas>=1.2 +pandas>=2 Pillow>=7.0 Sphinx>=4 sphinx-autodoc-annotation>=1.0 diff --git a/docs/source/_static/requirements_optional.csv b/docs/source/_static/requirements_optional.csv index db82a40e..dc9d20f9 100644 --- a/docs/source/_static/requirements_optional.csv +++ b/docs/source/_static/requirements_optional.csv @@ -4,6 +4,6 @@ ipywidgets,8,Jupyter notebook support mpi4py,3,Parallel processing using MPI napari,0.4.8,Displaying images interactively numba-mpi,0.22,Parallel processing using MPI+numba -pandas,1.2,Handling tabular data +pandas,2,Handling tabular data pyfftw,0.12,Faster Fourier transforms rocket-fft,0.2,Numba-compiled fast Fourier transforms diff --git a/pde/tools/resources/requirements_full.txt b/pde/tools/resources/requirements_full.txt index dcb45097..3911d046 100644 --- a/pde/tools/resources/requirements_full.txt +++ b/pde/tools/resources/requirements_full.txt @@ -3,7 +3,7 @@ h5py>=2.10 matplotlib>=3.1 numba>=0.59 numpy>=1.22 -pandas>=1.2 +pandas>=2 pyfftw>=0.12 rocket-fft>=0.2 scipy>=1.10 diff --git a/pde/tools/resources/requirements_mpi.txt b/pde/tools/resources/requirements_mpi.txt index c8855bae..af4b800c 100644 --- a/pde/tools/resources/requirements_mpi.txt +++ b/pde/tools/resources/requirements_mpi.txt @@ -5,7 +5,7 @@ mpi4py>=3 numba>=0.59 numba-mpi>=0.22 numpy>=1.22 -pandas>=1.2 +pandas>=2 scipy>=1.10 sympy>=1.9 tqdm>=4.66 diff --git a/pyproject.toml b/pyproject.toml index 1b5b1498..c6cd0d2c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,7 +31,7 @@ dependencies = ["matplotlib>=3.1", "numba>=0.59", "numpy>=1.22", "scipy>=1.10", [project.optional-dependencies] hdf = ["h5py>=2.10"] -io = ["h5py>=2.10", "pandas>=1.2"] +io = ["h5py>=2.10", "pandas>=2"] interactive = ["napari>=0.4.8", "ipywidgets>=8"] mpi = ["numba-mpi>=0.22", "mpi4py>=3"] diff --git a/scripts/create_requirements.py b/scripts/create_requirements.py index 3d73ca2c..ee76b429 100755 --- a/scripts/create_requirements.py +++ b/scripts/create_requirements.py @@ -103,7 +103,7 @@ def line(self, relation: str = ">=") -> str: ), Requirement( name="pandas", - version_min="1.2", + version_min="2", usage="Handling tabular data", collections={"full", "multiprocessing", "docs"}, ), @@ -156,8 +156,8 @@ def line(self, relation: str = ">=") -> str: Requirement(name="black", version_min="24.*", tests_only=True), Requirement(name="importlib-metadata", version_min="5", tests_only=True), Requirement(name="isort", version_min="5.1", tests_only=True), - Requirement(name="mypy", version_min="0.770", tests_only=True), - Requirement(name="notebook", version_min="7", relation="~=", tests_only=True), + Requirement(name="mypy", version_min="1.8", tests_only=True), + Requirement(name="notebook", version_min="7", tests_only=True), Requirement(name="pyupgrade", version_min="3", tests_only=True), Requirement(name="pytest", version_min="5.4", tests_only=True), Requirement(name="pytest-cov", version_min="2.8", tests_only=True), diff --git a/tests/requirements.txt b/tests/requirements.txt index 876b8da9..d7f7c8e1 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -3,8 +3,8 @@ black>=24.* importlib-metadata>=5 isort>=5.1 jupyter_contrib_nbextensions>=0.5 -mypy>=0.770 -notebook~=7 +mypy>=1.8 +notebook>=7 pytest>=5.4 pytest-cov>=2.8 pytest-xdist>=1.30 diff --git a/tests/requirements_full.txt b/tests/requirements_full.txt index dcb45097..3911d046 100644 --- a/tests/requirements_full.txt +++ b/tests/requirements_full.txt @@ -3,7 +3,7 @@ h5py>=2.10 matplotlib>=3.1 numba>=0.59 numpy>=1.22 -pandas>=1.2 +pandas>=2 pyfftw>=0.12 rocket-fft>=0.2 scipy>=1.10 diff --git a/tests/requirements_mpi.txt b/tests/requirements_mpi.txt index 3be9e6bc..82ab6622 100644 --- a/tests/requirements_mpi.txt +++ b/tests/requirements_mpi.txt @@ -5,7 +5,7 @@ mpi4py>=3 numba>=0.59 numba-mpi>=0.22 numpy>=1.22 -pandas>=1.2 +pandas>=2 scipy>=1.10 sympy>=1.9 tqdm>=4.66 From a103f24a261b108d7f0f7fbb0480110ba394eff5 Mon Sep 17 00:00:00 2001 From: David Zwicker Date: Mon, 5 Feb 2024 12:22:28 +0100 Subject: [PATCH 07/13] Removed pyFFTW requirement until it supports python 3.12 --- .github/workflows/check_docs.yml | 3 ++- pde/tools/resources/requirements_full.txt | 1 - scripts/create_requirements.py | 2 +- tests/requirements_full.txt | 1 - 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/check_docs.yml b/.github/workflows/check_docs.yml index 7f8bbe29..7f284dcb 100644 --- a/.github/workflows/check_docs.yml +++ b/.github/workflows/check_docs.yml @@ -8,7 +8,8 @@ jobs: timeout-minutes: 15 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + - uses: ammaraskar/sphinx-action@master with: docs-folder: "docs/" diff --git a/pde/tools/resources/requirements_full.txt b/pde/tools/resources/requirements_full.txt index 3911d046..5a98e681 100644 --- a/pde/tools/resources/requirements_full.txt +++ b/pde/tools/resources/requirements_full.txt @@ -4,7 +4,6 @@ matplotlib>=3.1 numba>=0.59 numpy>=1.22 pandas>=2 -pyfftw>=0.12 rocket-fft>=0.2 scipy>=1.10 sympy>=1.9 diff --git a/scripts/create_requirements.py b/scripts/create_requirements.py index ee76b429..70f20735 100755 --- a/scripts/create_requirements.py +++ b/scripts/create_requirements.py @@ -111,7 +111,7 @@ def line(self, relation: str = ">=") -> str: name="pyfftw", version_min="0.12", usage="Faster Fourier transforms", - collections={"full"}, + collections={}, # include in "full" collection when pyfftw supports python 3.12 ), Requirement( name="rocket-fft", diff --git a/tests/requirements_full.txt b/tests/requirements_full.txt index 3911d046..5a98e681 100644 --- a/tests/requirements_full.txt +++ b/tests/requirements_full.txt @@ -4,7 +4,6 @@ matplotlib>=3.1 numba>=0.59 numpy>=1.22 pandas>=2 -pyfftw>=0.12 rocket-fft>=0.2 scipy>=1.10 sympy>=1.9 From 0046de13d6ae8e32512c830a250bf525234e05b6 Mon Sep 17 00:00:00 2001 From: David Zwicker Date: Wed, 7 Feb 2024 09:00:11 +0100 Subject: [PATCH 08/13] Bumped `rocket-fft` to new version --- docs/source/_static/requirements_optional.csv | 2 +- pde/tools/resources/requirements_full.txt | 2 +- scripts/create_requirements.py | 2 +- tests/requirements_full.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/source/_static/requirements_optional.csv b/docs/source/_static/requirements_optional.csv index dc9d20f9..c06293af 100644 --- a/docs/source/_static/requirements_optional.csv +++ b/docs/source/_static/requirements_optional.csv @@ -6,4 +6,4 @@ napari,0.4.8,Displaying images interactively numba-mpi,0.22,Parallel processing using MPI+numba pandas,2,Handling tabular data pyfftw,0.12,Faster Fourier transforms -rocket-fft,0.2,Numba-compiled fast Fourier transforms +rocket-fft,0.2.4,Numba-compiled fast Fourier transforms diff --git a/pde/tools/resources/requirements_full.txt b/pde/tools/resources/requirements_full.txt index 5a98e681..b901132d 100644 --- a/pde/tools/resources/requirements_full.txt +++ b/pde/tools/resources/requirements_full.txt @@ -4,7 +4,7 @@ matplotlib>=3.1 numba>=0.59 numpy>=1.22 pandas>=2 -rocket-fft>=0.2 +rocket-fft>=0.2.4 scipy>=1.10 sympy>=1.9 tqdm>=4.66 diff --git a/scripts/create_requirements.py b/scripts/create_requirements.py index 70f20735..2d6da2cb 100755 --- a/scripts/create_requirements.py +++ b/scripts/create_requirements.py @@ -115,7 +115,7 @@ def line(self, relation: str = ">=") -> str: ), Requirement( name="rocket-fft", - version_min="0.2", + version_min="0.2.4", usage="Numba-compiled fast Fourier transforms", collections={"full"}, ), diff --git a/tests/requirements_full.txt b/tests/requirements_full.txt index 5a98e681..b901132d 100644 --- a/tests/requirements_full.txt +++ b/tests/requirements_full.txt @@ -4,7 +4,7 @@ matplotlib>=3.1 numba>=0.59 numpy>=1.22 pandas>=2 -rocket-fft>=0.2 +rocket-fft>=0.2.4 scipy>=1.10 sympy>=1.9 tqdm>=4.66 From 0ddd294ced82a1e4c7cc3ed08075d5c4db6e743e Mon Sep 17 00:00:00 2001 From: David Zwicker Date: Thu, 8 Feb 2024 14:34:10 +0100 Subject: [PATCH 09/13] Update jupyter notebooks --- examples/jupyter/Different solvers.ipynb | 4 ++-- examples/jupyter/Discretized Fields.ipynb | 2 +- examples/jupyter/Solve PDEs.ipynb | 2 +- examples/tutorial/Tutorial 1 - Grids and fields.ipynb | 6 ++---- ...ng pre-defined partial differential equations.ipynb | 10 +++------- 5 files changed, 9 insertions(+), 15 deletions(-) diff --git a/examples/jupyter/Different solvers.ipynb b/examples/jupyter/Different solvers.ipynb index 4bd81c99..7f5b878b 100644 --- a/examples/jupyter/Different solvers.ipynb +++ b/examples/jupyter/Different solvers.ipynb @@ -69,7 +69,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -83,7 +83,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.7" + "version": "3.12.0" }, "toc": { "base_numbering": 1, diff --git a/examples/jupyter/Discretized Fields.ipynb b/examples/jupyter/Discretized Fields.ipynb index 09d340df..74c08e6e 100644 --- a/examples/jupyter/Discretized Fields.ipynb +++ b/examples/jupyter/Discretized Fields.ipynb @@ -113,7 +113,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.7" + "version": "3.12.0" }, "toc": { "base_numbering": 1, diff --git a/examples/jupyter/Solve PDEs.ipynb b/examples/jupyter/Solve PDEs.ipynb index b6278899..5186863a 100644 --- a/examples/jupyter/Solve PDEs.ipynb +++ b/examples/jupyter/Solve PDEs.ipynb @@ -123,7 +123,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.12.0" }, "toc": { "base_numbering": 1, diff --git a/examples/tutorial/Tutorial 1 - Grids and fields.ipynb b/examples/tutorial/Tutorial 1 - Grids and fields.ipynb index 820364c5..74289a54 100644 --- a/examples/tutorial/Tutorial 1 - Grids and fields.ipynb +++ b/examples/tutorial/Tutorial 1 - Grids and fields.ipynb @@ -543,9 +543,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "scrolled": false - }, + "metadata": {}, "outputs": [], "source": [ "(collection[0] + collection[1]).plot(\"image\");" @@ -596,7 +594,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.7" + "version": "3.12.0" }, "toc": { "base_numbering": 1, diff --git a/examples/tutorial/Tutorial 2 - Solving pre-defined partial differential equations.ipynb b/examples/tutorial/Tutorial 2 - Solving pre-defined partial differential equations.ipynb index 3fe16549..13ac0c50 100644 --- a/examples/tutorial/Tutorial 2 - Solving pre-defined partial differential equations.ipynb +++ b/examples/tutorial/Tutorial 2 - Solving pre-defined partial differential equations.ipynb @@ -366,9 +366,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "scrolled": false - }, + "metadata": {}, "outputs": [], "source": [ "class KuramotoSivashinskyPDE(pde.PDEBase):\n", @@ -449,9 +447,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "scrolled": false - }, + "metadata": {}, "outputs": [], "source": [ "# plot both fields and give the deviation as the title\n", @@ -483,7 +479,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.10" + "version": "3.12.0" }, "toc": { "base_numbering": 1, From a3ec51f634c4672ea91526a729836dcbe740492b Mon Sep 17 00:00:00 2001 From: David Zwicker Date: Thu, 8 Feb 2024 14:54:39 +0100 Subject: [PATCH 10/13] Replace `jupyter run` by `jupyter execute` --- tests/test_examples.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_examples.py b/tests/test_examples.py index 21dc2dc7..75e72f8d 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -106,4 +106,4 @@ def test_jupyter_notebooks(path, tmp_path): ) else: # run the notebook - sp.check_call([sys.executable, "-m", "jupyter", "run", path], env=my_env) + sp.check_call([sys.executable, "-m", "jupyter", "execute", path], env=my_env) From a87e3b7858cedb5734866979249edba6aa6049f4 Mon Sep 17 00:00:00 2001 From: David Zwicker Date: Thu, 8 Feb 2024 16:02:10 +0100 Subject: [PATCH 11/13] Removed a unicode character to please Windows --- examples/jupyter/Solve PDEs.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/jupyter/Solve PDEs.ipynb b/examples/jupyter/Solve PDEs.ipynb index 5186863a..debcf1bd 100644 --- a/examples/jupyter/Solve PDEs.ipynb +++ b/examples/jupyter/Solve PDEs.ipynb @@ -83,7 +83,7 @@ "class ChafeeInfantePDE(pde.PDEBase):\n", " \"\"\"minimal model of a custom pde\n", "\n", - " Taken from https://en.wikipedia.org/wiki/Chafee–Infante_equation\n", + " Taken from https://en.wikipedia.org/wiki/Chafee-Infante_equation\n", " \"\"\"\n", "\n", " def __init__(self, λ=1, bc=\"natural\"):\n", From 07ceb0a7c8567aee3d57c1981e95904e4ca1aa3f Mon Sep 17 00:00:00 2001 From: David Zwicker Date: Thu, 8 Feb 2024 16:15:17 +0100 Subject: [PATCH 12/13] Try updating pip before testing documentation --- .github/workflows/check_docs.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/check_docs.yml b/.github/workflows/check_docs.yml index 7f284dcb..cd8ef862 100644 --- a/.github/workflows/check_docs.yml +++ b/.github/workflows/check_docs.yml @@ -13,3 +13,4 @@ jobs: - uses: ammaraskar/sphinx-action@master with: docs-folder: "docs/" + pre-build-command: "pip install --upgrade pip" From 7c3d8f62f49104a216c8316ba7804965bedec480 Mon Sep 17 00:00:00 2001 From: David Zwicker Date: Thu, 8 Feb 2024 16:21:17 +0100 Subject: [PATCH 13/13] Removed all unicode characters from jupyter notebook --- examples/jupyter/Solve PDEs.ipynb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/jupyter/Solve PDEs.ipynb b/examples/jupyter/Solve PDEs.ipynb index debcf1bd..0afe6097 100644 --- a/examples/jupyter/Solve PDEs.ipynb +++ b/examples/jupyter/Solve PDEs.ipynb @@ -86,13 +86,13 @@ " Taken from https://en.wikipedia.org/wiki/Chafee-Infante_equation\n", " \"\"\"\n", "\n", - " def __init__(self, λ=1, bc=\"natural\"):\n", + " def __init__(self, lmbd=1, bc=\"natural\"):\n", " super().__init__()\n", " self.bc = bc\n", - " self.λ = λ\n", + " self.lmbd = lmbd\n", "\n", " def evolution_rate(self, state, t=0):\n", - " return state.laplace(bc=self.bc) - self.λ * (state**3 - state)" + " return state.laplace(bc=self.bc) - self.lmbd * (state**3 - state)" ] }, {