Skip to content

Commit

Permalink
Bump allowed python version to 3.12 (#473)
Browse files Browse the repository at this point in the history
* Bumped allowed python version to 3.12
* Raised minimal python version to 3.9
* Bumped some more requirements
* Removed pyFFTW requirement until it supports python 3.12
* Updated jupyter notebooks
  • Loading branch information
david-zwicker authored Feb 8, 2024
1 parent c5f478e commit 5180993
Show file tree
Hide file tree
Showing 55 changed files with 166 additions and 163 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/check_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ jobs:
timeout-minutes: 15

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: ammaraskar/sphinx-action@master
with:
docs-folder: "docs/"
pre-build-command: "pip install --upgrade pip"
2 changes: 1 addition & 1 deletion .github/workflows/release_pip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests_all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests_minversion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests_mpi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests_types.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
pyversion: ['3.8', '3.11']
pyversion: ['3.9', '3.12']
timeout-minutes: 30

steps:
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3.8"
python: "3.11"
apt_packages:
- graphviz

Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions docs/source/_static/requirements_main.csv
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
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
tqdm,4.60,Display progress bars during calculations
tqdm,4.66,Display progress bars during calculations
6 changes: 3 additions & 3 deletions docs/source/_static/requirements_optional.csv
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
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
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
rocket-fft,0.2.4,Numba-compiled fast Fourier transforms
4 changes: 2 additions & 2 deletions examples/jupyter/Different solvers.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -83,7 +83,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
"version": "3.12.0"
},
"toc": {
"base_numbering": 1,
Expand Down
2 changes: 1 addition & 1 deletion examples/jupyter/Discretized Fields.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
"version": "3.12.0"
},
"toc": {
"base_numbering": 1,
Expand Down
10 changes: 5 additions & 5 deletions examples/jupyter/Solve PDEs.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,16 @@
"class ChafeeInfantePDE(pde.PDEBase):\n",
" \"\"\"minimal model of a custom pde\n",
"\n",
" Taken from https://en.wikipedia.org/wiki/ChafeeInfante_equation\n",
" 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)"
]
},
{
Expand Down Expand Up @@ -123,7 +123,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.12.0"
},
"toc": {
"base_numbering": 1,
Expand Down
6 changes: 2 additions & 4 deletions examples/tutorial/Tutorial 1 - Grids and fields.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -543,9 +543,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": false
},
"metadata": {},
"outputs": [],
"source": [
"(collection[0] + collection[1]).plot(\"image\");"
Expand Down Expand Up @@ -596,7 +594,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
"version": "3.12.0"
},
"toc": {
"base_numbering": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": false
},
"metadata": {},
"outputs": [],
"source": [
"class KuramotoSivashinskyPDE(pde.PDEBase):\n",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -483,7 +479,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.10"
"version": "3.12.0"
},
"toc": {
"base_numbering": 1,
Expand Down
2 changes: 1 addition & 1 deletion pde/fields/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pde/fields/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion pde/fields/scalar.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion pde/fields/tensorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion pde/fields/vectorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion pde/grids/_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
13 changes: 2 additions & 11 deletions pde/grids/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion pde/grids/boundaries/axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions pde/grids/boundaries/axis.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -24,9 +24,9 @@
from .._mesh import GridMesh

BoundaryPairData = Union[
Dict[str, BoundaryData],
dict[str, BoundaryData],
BoundaryData,
Tuple[BoundaryData, BoundaryData],
tuple[BoundaryData, BoundaryData],
"BoundaryAxisBase",
]

Expand Down
6 changes: 3 additions & 3 deletions pde/grids/boundaries/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -86,7 +86,7 @@
from .._mesh import GridMesh


BoundaryData = Union[Dict, str, "BCBase"]
BoundaryData = Union[dict, str, "BCBase"]


class BCDataError(ValueError):
Expand Down Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion pde/grids/cartesian.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion pde/grids/cylindrical.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion pde/solvers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions pde/solvers/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")


Expand Down
Loading

0 comments on commit 5180993

Please sign in to comment.