diff --git a/.github/workflows/pythonapp.yml b/.github/workflows/pythonapp.yml index 4ad278ba2..c1456f2ac 100644 --- a/.github/workflows/pythonapp.yml +++ b/.github/workflows/pythonapp.yml @@ -21,12 +21,12 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: ['3.9', '3.10', '3.11'] + python-version: ['3.9', '3.10', '3.11', '3.12'] steps: - name: Checkout FFCx uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies (non-Python, Linux) @@ -46,7 +46,7 @@ jobs: run: flake8 --statistics ffcx/ test/ - name: Static check with mypy run: mypy ffcx/ - if: matrix.python-version != '3.11' + if: matrix.python-version != '3.12' - name: isort checks (non-blocking) continue-on-error: true run: isort --check . diff --git a/demo/Components.py b/demo/Components.py index 803e8e41c..39893259f 100644 --- a/demo/Components.py +++ b/demo/Components.py @@ -17,8 +17,8 @@ # # This example demonstrates how to create vectors component-wise import basix.ufl -from ufl import (Coefficient, FunctionSpace, Mesh, TestFunction, as_vector, - inner, dx) +from ufl import (Coefficient, FunctionSpace, Mesh, TestFunction, as_vector, dx, + inner) element = basix.ufl.element("Lagrange", "tetrahedron", 1, shape=(3, )) domain = Mesh(element) diff --git a/demo/Conditional.py b/demo/Conditional.py index b0597d1cb..ca7b51e3e 100644 --- a/demo/Conditional.py +++ b/demo/Conditional.py @@ -18,8 +18,8 @@ # Illustration on how to use Conditional to define a source term import basix.ufl from ufl import (And, Constant, FunctionSpace, Mesh, Not, Or, - SpatialCoordinate, TestFunction, conditional, dx, ge, gt, inner, le, - lt) + SpatialCoordinate, TestFunction, conditional, dx, ge, gt, + inner, le, lt) element = basix.ufl.element("Lagrange", "triangle", 2) domain = Mesh(basix.ufl.element("Lagrange", "triangle", 1, shape=(2, ))) diff --git a/demo/MetaData.py b/demo/MetaData.py index 9b73a86dd..f7f12177c 100644 --- a/demo/MetaData.py +++ b/demo/MetaData.py @@ -17,8 +17,8 @@ # # Test form for metadata. import basix.ufl -from ufl import (Coefficient, Constant, FunctionSpace, Mesh, TestFunction, TrialFunction, - dx, grad, inner) +from ufl import (Coefficient, Constant, FunctionSpace, Mesh, TestFunction, + TrialFunction, dx, grad, inner) element = basix.ufl.element("Lagrange", "triangle", 1) vector_element = basix.ufl.element("Lagrange", "triangle", 1, shape=(2, )) diff --git a/demo/Normals.py b/demo/Normals.py index caa9fe05e..7f745a3ed 100644 --- a/demo/Normals.py +++ b/demo/Normals.py @@ -19,7 +19,7 @@ # Merely project the normal onto a vector section. import basix.ufl from ufl import (FacetNormal, FunctionSpace, Mesh, TestFunction, TrialFunction, - inner, ds, triangle) + ds, inner, triangle) cell = triangle diff --git a/ffcx/codegeneration/definitions.py b/ffcx/codegeneration/definitions.py index 87f23cdf0..aa786358e 100644 --- a/ffcx/codegeneration/definitions.py +++ b/ffcx/codegeneration/definitions.py @@ -6,14 +6,13 @@ """FFCx/UFC specific variable definitions.""" import logging +from typing import List, Union import ffcx.codegeneration.lnodes as L +import ufl +from ffcx.ir.analysis.modified_terminals import ModifiedTerminal from ffcx.ir.elementtables import UniqueTableReferenceT from ffcx.ir.representationutils import QuadratureRule -from ffcx.ir.analysis.modified_terminals import ModifiedTerminal -from typing import List, Union -import ufl - logger = logging.getLogger("ffcx") diff --git a/ffcx/codegeneration/integral_generator.py b/ffcx/codegeneration/integral_generator.py index 68f942d3c..4e54569bf 100644 --- a/ffcx/codegeneration/integral_generator.py +++ b/ffcx/codegeneration/integral_generator.py @@ -6,6 +6,7 @@ import collections import logging +from numbers import Integral from typing import Any, Dict, List, Set, Tuple import ffcx.codegeneration.lnodes as L @@ -13,11 +14,10 @@ from ffcx.codegeneration import geometry from ffcx.codegeneration.definitions import (create_dof_index, create_quadrature_index) +from ffcx.codegeneration.optimizer import optimize from ffcx.ir.elementtables import piecewise_ttypes from ffcx.ir.integral import BlockDataT from ffcx.ir.representationutils import QuadratureRule -from ffcx.codegeneration.optimizer import optimize -from numbers import Integral logger = logging.getLogger("ffcx") diff --git a/ffcx/codegeneration/lnodes.py b/ffcx/codegeneration/lnodes.py index 8a9bc8d0b..8ccbbc9e1 100644 --- a/ffcx/codegeneration/lnodes.py +++ b/ffcx/codegeneration/lnodes.py @@ -4,10 +4,11 @@ # # SPDX-License-Identifier: LGPL-3.0-or-later -from typing import List, Optional, Sequence import numbers -from enum import Enum import typing +from enum import Enum +from typing import List, Optional, Sequence + import numpy as np import ufl diff --git a/ffcx/codegeneration/optimizer.py b/ffcx/codegeneration/optimizer.py index b6d886640..ed7c6988f 100644 --- a/ffcx/codegeneration/optimizer.py +++ b/ffcx/codegeneration/optimizer.py @@ -1,6 +1,7 @@ +from collections import defaultdict from typing import List, Union + import ffcx.codegeneration.lnodes as L -from collections import defaultdict from ffcx.ir.representationutils import QuadratureRule diff --git a/pyproject.toml b/pyproject.toml index ee19ae597..9a9951787 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,6 +16,7 @@ authors = [ dependencies = [ "numpy>=1.21", "cffi", + "setuptools; python_version >= '3.12'", # cffi with compilation support requires setuptools "fenics-basix >= 0.8.0.dev0, <0.9.0", "fenics-ufl >= 2023.3.0.dev0, <2023.4.0", ] diff --git a/test/test_lnodes.py b/test/test_lnodes.py index ba1931b09..4fec78152 100644 --- a/test/test_lnodes.py +++ b/test/test_lnodes.py @@ -18,7 +18,7 @@ def test_gemm(dtype): A = L.Symbol("A", dtype=L.DataType.SCALAR) B = L.Symbol("B", dtype=L.DataType.SCALAR) C = L.Symbol("C", dtype=L.DataType.SCALAR) - code = [L.Comment(f"Matrix multiply A{p,r} = B{p,q} * C{q,r}")] + code = [L.Comment(f"Matrix multiply A{p, r} = B{p, q} * C{q, r}")] i = L.Symbol("i", dtype=L.DataType.INT) j = L.Symbol("j", dtype=L.DataType.INT) @@ -66,7 +66,7 @@ def test_gemv(dtype): y = L.Symbol("y", dtype=L.DataType.SCALAR) A = L.Symbol("A", dtype=L.DataType.SCALAR) x = L.Symbol("x", dtype=L.DataType.SCALAR) - code = [L.Comment(f"Matrix-vector multiply y({p}) = A{p,q} * x({q})")] + code = [L.Comment(f"Matrix-vector multiply y({p}) = A{p, q} * x({q})")] i = L.Symbol("i", dtype=L.DataType.INT) j = L.Symbol("j", dtype=L.DataType.INT)