Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Python 3.12 coverage to CI #663

Merged
merged 5 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/pythonapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 .
Expand Down
4 changes: 2 additions & 2 deletions demo/Components.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions demo/Conditional.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, )))
Expand Down
4 changes: 2 additions & 2 deletions demo/MetaData.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, ))
Expand Down
2 changes: 1 addition & 1 deletion demo/Normals.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 3 additions & 4 deletions ffcx/codegeneration/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
4 changes: 2 additions & 2 deletions ffcx/codegeneration/integral_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@

import collections
import logging
from numbers import Integral
from typing import Any, Dict, List, Set, Tuple

import ffcx.codegeneration.lnodes as L
import ufl
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")

Expand Down
5 changes: 3 additions & 2 deletions ffcx/codegeneration/lnodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion ffcx/codegeneration/optimizer.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]
Expand Down
4 changes: 2 additions & 2 deletions test/test_lnodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down