From 41e45b177d9985fa90ec8e7c5cf1009311066550 Mon Sep 17 00:00:00 2001 From: Francesco Ballarin Date: Thu, 10 Mar 2022 08:48:12 +0100 Subject: [PATCH] Add explicit import of numpy.typing in sources, tests and tutorials, and require numpy >= 1.21 --- rbnicsx/_backends/online_tensors.py | 1 + rbnicsx/_backends/proper_orthogonal_decomposition.py | 1 + rbnicsx/_backends/tensors_array.py | 1 + rbnicsx/backends/export.py | 1 + rbnicsx/backends/mesh_motion.py | 1 + rbnicsx/backends/proper_orthogonal_decomposition.py | 1 + rbnicsx/backends/tensors_array.py | 1 + rbnicsx/online/proper_orthogonal_decomposition.py | 1 + setup.cfg | 2 +- tests/unit/backends/test_backends_mesh_motion.py | 1 + tests/unit/conftest.py | 1 + tutorials/01_thermal_block.ipynb | 1 + tutorials/02_elastic_block.ipynb | 1 + tutorials/03_hole.ipynb | 1 + tutorials/04_graetz.ipynb | 1 + tutorials/05_gaussian.ipynb | 1 + tutorials/07_nonlinear_elliptic.ipynb | 1 + tutorials/12_stokes.ipynb | 1 + tutorials/17_navier_stokes.ipynb | 1 + 19 files changed, 19 insertions(+), 1 deletion(-) diff --git a/rbnicsx/_backends/online_tensors.py b/rbnicsx/_backends/online_tensors.py index d4f925e..f742ae8 100644 --- a/rbnicsx/_backends/online_tensors.py +++ b/rbnicsx/_backends/online_tensors.py @@ -13,6 +13,7 @@ import mpi4py.MPI import numpy as np +import numpy.typing import petsc4py.PETSc diff --git a/rbnicsx/_backends/proper_orthogonal_decomposition.py b/rbnicsx/_backends/proper_orthogonal_decomposition.py index c4e4efe..73ebed8 100644 --- a/rbnicsx/_backends/proper_orthogonal_decomposition.py +++ b/rbnicsx/_backends/proper_orthogonal_decomposition.py @@ -8,6 +8,7 @@ import typing import numpy as np +import numpy.typing import petsc4py.PETSc import slepc4py.SLEPc diff --git a/rbnicsx/_backends/tensors_array.py b/rbnicsx/_backends/tensors_array.py index c516756..85fbeed 100644 --- a/rbnicsx/_backends/tensors_array.py +++ b/rbnicsx/_backends/tensors_array.py @@ -14,6 +14,7 @@ import mpi4py.MPI import numpy as np +import numpy.typing import petsc4py.PETSc from rbnicsx.io import on_rank_zero diff --git a/rbnicsx/backends/export.py b/rbnicsx/backends/export.py index 1940c50..3340841 100644 --- a/rbnicsx/backends/export.py +++ b/rbnicsx/backends/export.py @@ -11,6 +11,7 @@ import dolfinx.fem import dolfinx.io import numpy as np +import numpy.typing import petsc4py.PETSc from rbnicsx._backends.export import ( diff --git a/rbnicsx/backends/mesh_motion.py b/rbnicsx/backends/mesh_motion.py index 02b1f4f..886888d 100644 --- a/rbnicsx/backends/mesh_motion.py +++ b/rbnicsx/backends/mesh_motion.py @@ -13,6 +13,7 @@ import dolfinx.fem import dolfinx.mesh import numpy as np +import numpy.typing import petsc4py.PETSc diff --git a/rbnicsx/backends/proper_orthogonal_decomposition.py b/rbnicsx/backends/proper_orthogonal_decomposition.py index dc54a92..ed73cf8 100644 --- a/rbnicsx/backends/proper_orthogonal_decomposition.py +++ b/rbnicsx/backends/proper_orthogonal_decomposition.py @@ -10,6 +10,7 @@ import dolfinx.fem import numpy as np +import numpy.typing import petsc4py.PETSc from rbnicsx._backends.proper_orthogonal_decomposition import ( diff --git a/rbnicsx/backends/tensors_array.py b/rbnicsx/backends/tensors_array.py index 305228f..0773f29 100644 --- a/rbnicsx/backends/tensors_array.py +++ b/rbnicsx/backends/tensors_array.py @@ -12,6 +12,7 @@ import dolfinx.fem import mpi4py.MPI import numpy as np +import numpy.typing from rbnicsx._backends.tensors_array import TensorsArray as TensorsArrayBase from rbnicsx.backends.export import export_matrices, export_vectors diff --git a/rbnicsx/online/proper_orthogonal_decomposition.py b/rbnicsx/online/proper_orthogonal_decomposition.py index 75a6ac3..9bc4efb 100644 --- a/rbnicsx/online/proper_orthogonal_decomposition.py +++ b/rbnicsx/online/proper_orthogonal_decomposition.py @@ -9,6 +9,7 @@ import typing import numpy as np +import numpy.typing import petsc4py.PETSc from rbnicsx._backends.proper_orthogonal_decomposition import ( diff --git a/setup.cfg b/setup.cfg index 8b09254..e01739d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -39,7 +39,7 @@ install_requires = cppimport mpi4py multipledispatch - numpy + numpy >= 1.21.0 petsc4py slepc4py diff --git a/tests/unit/backends/test_backends_mesh_motion.py b/tests/unit/backends/test_backends_mesh_motion.py index b755223..d2c1299 100644 --- a/tests/unit/backends/test_backends_mesh_motion.py +++ b/tests/unit/backends/test_backends_mesh_motion.py @@ -12,6 +12,7 @@ import dolfinx.mesh import mpi4py.MPI import numpy as np +import numpy.typing import pytest import rbnicsx.backends diff --git a/tests/unit/conftest.py b/tests/unit/conftest.py index 855d4c2..1b74f65 100644 --- a/tests/unit/conftest.py +++ b/tests/unit/conftest.py @@ -15,6 +15,7 @@ import _pytest.compat import nbvalx.pytest_hooks_unit_tests import numpy as np +import numpy.typing import petsc4py.PETSc import pytest import scipy.sparse diff --git a/tutorials/01_thermal_block.ipynb b/tutorials/01_thermal_block.ipynb index 9558b54..64d9b78 100644 --- a/tutorials/01_thermal_block.ipynb +++ b/tutorials/01_thermal_block.ipynb @@ -33,6 +33,7 @@ "import multiphenicsx.io\n", "import multiphenicsx.mesh\n", "import numpy as np\n", + "import numpy.typing\n", "import petsc4py.PETSc\n", "import plotly.graph_objects as go\n", "import slepc4py.SLEPc\n", diff --git a/tutorials/02_elastic_block.ipynb b/tutorials/02_elastic_block.ipynb index 6a84db7..5e14750 100644 --- a/tutorials/02_elastic_block.ipynb +++ b/tutorials/02_elastic_block.ipynb @@ -30,6 +30,7 @@ "import multiphenicsx.io\n", "import multiphenicsx.mesh\n", "import numpy as np\n", + "import numpy.typing\n", "import petsc4py.PETSc\n", "import ufl" ] diff --git a/tutorials/03_hole.ipynb b/tutorials/03_hole.ipynb index 92a74a4..d39d4ec 100644 --- a/tutorials/03_hole.ipynb +++ b/tutorials/03_hole.ipynb @@ -32,6 +32,7 @@ "import multiphenicsx.io\n", "import multiphenicsx.mesh\n", "import numpy as np\n", + "import numpy.typing\n", "import petsc4py.PETSc\n", "import plotly.graph_objects as go\n", "import ufl" diff --git a/tutorials/04_graetz.ipynb b/tutorials/04_graetz.ipynb index 79fa8cf..45492b5 100644 --- a/tutorials/04_graetz.ipynb +++ b/tutorials/04_graetz.ipynb @@ -30,6 +30,7 @@ "import multiphenicsx.io\n", "import multiphenicsx.mesh\n", "import numpy as np\n", + "import numpy.typing\n", "import petsc4py.PETSc\n", "import ufl" ] diff --git a/tutorials/05_gaussian.ipynb b/tutorials/05_gaussian.ipynb index cf0bdfb..0ea795c 100644 --- a/tutorials/05_gaussian.ipynb +++ b/tutorials/05_gaussian.ipynb @@ -30,6 +30,7 @@ "import multiphenicsx.io\n", "import multiphenicsx.mesh\n", "import numpy as np\n", + "import numpy.typing\n", "import petsc4py.PETSc\n", "import ufl" ] diff --git a/tutorials/07_nonlinear_elliptic.ipynb b/tutorials/07_nonlinear_elliptic.ipynb index c909fd3..240f63b 100644 --- a/tutorials/07_nonlinear_elliptic.ipynb +++ b/tutorials/07_nonlinear_elliptic.ipynb @@ -30,6 +30,7 @@ "import multiphenicsx.io\n", "import multiphenicsx.mesh\n", "import numpy as np\n", + "import numpy.typing\n", "import petsc4py.PETSc\n", "import ufl" ] diff --git a/tutorials/12_stokes.ipynb b/tutorials/12_stokes.ipynb index 06df966..886bd3a 100644 --- a/tutorials/12_stokes.ipynb +++ b/tutorials/12_stokes.ipynb @@ -31,6 +31,7 @@ "import multiphenicsx.io\n", "import multiphenicsx.mesh\n", "import numpy as np\n", + "import numpy.typing\n", "import petsc4py.PETSc\n", "import ufl" ] diff --git a/tutorials/17_navier_stokes.ipynb b/tutorials/17_navier_stokes.ipynb index 162bcfa..3d1f390 100644 --- a/tutorials/17_navier_stokes.ipynb +++ b/tutorials/17_navier_stokes.ipynb @@ -31,6 +31,7 @@ "import multiphenicsx.io\n", "import multiphenicsx.mesh\n", "import numpy as np\n", + "import numpy.typing\n", "import petsc4py.PETSc\n", "import ufl" ]